如何使用 cURL 执行多个同时请求? [英] How do I use cURL to perform multiple simultaneous requests?

查看:35
本文介绍了如何使用 cURL 执行多个同时请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 cURL 在我的服务器上测试洪水处理.现在我在 Windows 命令行上使用它:

I'd like to use cURL to test flood handling on my server. Right now I'm using this on a Windows command line:

curl www.example.com

这将 GET 页面一次.我现在想做同样的事情,除了一个请求,我想一次生成至少 10 个请求.我该怎么做?

which will GET the page once. I'd like to now do the same thing, except instead of one request, I want to generate at least 10 requests at once. How would I do this?

推荐答案

虽然 curl 是一个非常有用且灵活的工具,但并不适用于此类用途.还有其他可用的工具可以让您对同一个 URL 发出多个并发请求.

While curl is a very useful and flexible tool, isn't intended for this type of use. There are other tools available which will let you make multiple concurrent requests to the same URL.

ab 是这种类型的一个非常简单但有效的工具,适用于任何网络服务器(尽管介绍重点是 Apache 服务器).

ab is a very simple yet effective tool of this type, which works for any web server (despite the introduction focusing on Apache server).

Grinder 是一个更复杂的工具,它可以让您指定许多不同的 URL 以在负载测试中使用.这让您可以混合请求廉价和昂贵的页面,这可能更类似于您网站的标准负载.

Grinder is a more sophisticated tool, which can let you specify many different URLs to use in a load test. This lets you mix requests for cheap and expensive pages, which may more closely resemble standard load for your website.

这篇关于如何使用 cURL 执行多个同时请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆