V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
s82kd92l
V2EX  ›  NGINX

请问如何允许 aria2 多线程下载?

  •  
  •   s82kd92l · Feb 19, 2020 · 11521 views
    This topic created in 2263 days ago, the information mentioned may be changed or developed.
    我架了个自用的 nginx 用于中转一些文件,然后用 aria2 拉到本地。使用 aria2 时指定多线程-s5 -j5 无法生效,但是对很多别人的网站,这个是可以生效的,请问应该怎么配置 nginx 以便多线程呢?

    我的环境是:
    CentOS Linux release 7.7.1908 on openvz
    nginx version: nginx/1.16.1
    8 replies    2020-02-19 21:00:54 +08:00
    Nasei
        1
    Nasei  
       Feb 19, 2020 via Android
    我瞎猜一下,如果服务端不支持按范围下载之类的特性的话,就没法用多线程
    lxk11153
        2
    lxk11153  
       Feb 19, 2020
    1. https://aria2.github.io/manual/en/html/aria2c.html#cmdoption-j
    > --max-concurrent-downloads limits the number of items which are downloaded concurrently. --split and --min-split-size affect the number of connections inside each item.
    2. 还要这个感觉可以研究下
    > -x, --max-connection-per-server=<NUM>
    lxk11153
        3
    lxk11153  
       Feb 19, 2020
    #2 append 关于 1: 点链接还有更形象的例子说明
    nyanyh
        4
    nyanyh  
       Feb 19, 2020
    nginx 是不是设置了 limit_conn one 1;?
    s82kd92l
        6
    s82kd92l  
    OP
       Feb 19, 2020
    @lxk11153 加-x 果然有用,多谢!

    @nyanyh 搞定了,我没设置连接限制,谢啦!
    lxk11153
        7
    lxk11153  
       Feb 19, 2020
    @s82kd92l #6 仔细理解那几个配置了没?
    1. 同时下载任务数,比如同时下载 a,b,c 三个文件(批量下载)
    -j, --max-concurrent-downloads=<N>
    > Set the maximum number of parallel downloads for every queue item. Default: 5

    2. 两个影响每个文件分多少线程下载的参数
    -k, --min-split-size=<SIZE>
    文件分片大小 Default: 20M
    -s, --split=<N>
    > Download a file using N connections. Default: 5

    3. -x, --max-connection-per-server=<NUM>
    > The maximum number of connections to one server for each download. Default: 1
    orzfly
        8
    orzfly  
       Feb 19, 2020   ❤️ 8
    祖传参数: -s16 -x16 -k1M

    打熟了根本停不下来,哪怕都写进 rc 了也情不自禁会加上……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   875 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 376ms · UTC 22:47 · PVG 06:47 · LAX 15:47 · JFK 18:47
    ♥ Do have faith in what you're doing.