简体   繁体   English

对REST API的不同并发请求

[英]Different concurrent requests to REST API

I want to know how I can issue multiple, different cURL requests concurrently to a RESTful API, to test my application. 我想知道如何可以同时向RESTful API发出多个不同的cURL请求,以测试我的应用程序。 I'm using a Maru RESTful API for Elixir, and my requests only differ in the GET arguments. 我正在为Elixir使用Maru RESTful API,而我的请求仅在GET参数上有所不同。 My cURL requests look something like: 我的cURL请求看起来像:

curl -X GET http://localhost:8880/path -G -d "data1=abc&data2=123&..."

where the values of data1 , data2 etc. differ. 其中data1data2等的值不同。 I would prefer some sort of a tool like ab , the Apache HTTP server benchmarking tool, but ab only allows concurrent requests of the same kind. 我希望使用ab这样的工具,它是Apache HTTP服务器基准测试工具,但是ab只允许相同类型的并发请求。 I am trying to test my application for concurrent, differing responses to the different, concurrently issued cURL requests. 我试图测试我的应用程序对不同的,并发的cURL请求的并发,不同的响应。

You will need to make your cURL requests asynchronous , so they can run in the same time and when they are finished, a callback function is called. 您将需要使cURL请求异步 ,以便它们可以在同一时间运行,并在它们完成时调用一个回调函数。 However, this will not necessarily solve your problem, since there is a chance that the remote API is using something like IIS, serving requests sequentially. 但是,这不一定能解决您的问题,因为远程API可能会使用IIS之类的东西来顺序服务请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM