如何设置全局CURL速率(速度)限制? [英] How to set a global CURL rate(speed) limit?

查看:2654
本文介绍了如何设置全局CURL速率(速度)限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个环顾CURL设置文件,但没有找到它/ etc /并没有找到太多的curl网站ether ...

I had a look around for the CURL settings file but didn't find it in /etc/ and didn't find much on the curl site ether...

所以基本上我想做的设置curl可以上传的最大速度限制(无论它正在运行多少个实例),使我的服务器有一些上传容量留给其他任务。

So basically what I want to do set a maximum speed limit that curl can upload at (no matter how many instances of it are running) so that my server has some upload capacity left for other tasks.

推荐答案

很肯定你更新了你的问题,因为它肯定会使我原来的回答(TFM,下面)过时。

Pretty sure you updated your question, as it certainly makes my original answer (TFM, below) obsolete.

我怀疑你要求什么是可能的curl,因为我假设每个curl的实例彼此独立操作。

I doubt what you are asking for is possible within curl as I would assume that each instance of curl operates independently of each other.

你可以写一个脚本生成curl实例并根据总作业数设置每个作业的限制,但这不会是动态的。您可以通过强制所有curl命令通过某个端口或网络接口操作来模拟全局速率,然后使用QOS来限制它。

You could write a script that spawns curl instances and sets the limit of each individual job based on the number of total jobs, but this would not be dynamic. You could mimic a global rate by forcing all of your curl commands to operate through a certain port or network interface and then use QOS to throttle it.

但是,您可能应该只需找到处理作业队列并能够自行限速的下载实用程序。

However, you probably should just find a download utility that handles job queues and is capable of rate limiting on its own.


从TFM( man curl
--limit-rate
指定要使用的最大传输速率。如果您使用有限的管道,而您希望您的
汇款不使用您的整个带宽,则
功能非常有用。

From TFM (man curl) --limit-rate Specify the maximum transfer rate you want curl to use. This feature is useful if you have a limited pipe and you'd like your transfer not to use your entire bandwidth.

         The  given speed is measured in bytes/second, unless a suffix is
         appended.  Appending 'k' or 'K' will count the number  as  kilo-
         bytes,  'm'  or M' makes it megabytes, while 'g' or 'G' makes it
         gigabytes. Examples: 200K, 3m and 1G.

         The given rate is the average speed counted  during  the  entire
         transfer. It means that curl might use higher transfer speeds in
         short bursts, but over time it uses no more than the given rate.

         If  you  also  use the -Y/--speed-limit option, that option will
         take precedence and might cripple the rate-limiting slightly, to
         help keeping the speed-limit logic working.

         If this option is used several times, the last one will be used.


这篇关于如何设置全局CURL速率(速度)限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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