在C#中同时进行多个API调用。

huangapple go评论84阅读模式
英文:

Multiple Simultaneous API calls in C#

问题

我正在尝试对使用Dapper调用存储过程并进行大量验证的端点进行压力测试。我的想法是了解它如何处理同时发送的大约1000个API调用。

请注意,这是一个Get端点。

有什么建议吗?

我尝试使用线程池,但它不能同时运行1000个线程,我也考虑过任务(Task),但效果也一样,而对于循环来说,不适合任务或其他任何方法,因为仍然会存在每个方法运行之间的时间差异。

英文:

I am trying to stress test my Endpoint which works with dapper that calls procedure and has a lot of validation. Idea is to know how it can handle like 1000 API calls that was sent at the same time.

Note that it is Get Endpoint

Any idea?

I tried using thread pool, but it would not run 1000 of them at the same time, also I thought about Task but it was same here, also for loop is not option with tasks or anything else, because there still will be the time difference between each method run.

答案1

得分: 1

我建议使用专用的负载测试工具,如K6Bombardier
您可以在本地或云中运行所有基础架构,包括要测试的服务/系统,然后使用负载测试工具来测试您的服务。

PS:如果只需要快速进行HTTPGET端点调用,使用Bombardier可能更容易。

英文:

I would suggest using dedicated load testing tools like K6 or Bombardier.
You run all your infrastructure including the service/system you are tryng to test locally or in cloud and then run the load testing tools against your service.

PS: Bombardier might be easier if you just have to make quick HTTPGET endpoint calls

huangapple
  • 本文由 发表于 2023年7月23日 14:02:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76746821.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定