Learn about Centmin Mod LEMP Stack today
Register Now

Nginx Centmindmod + many user download large file = high io disk

Discussion in 'Install & Upgrades or Pre-Install Questions' started by babyshark, May 1, 2019.

  1. babyshark

    babyshark New Member

    20
    5
    3
    Jan 22, 2019
    Ratings:
    +7
    Local Time:
    1:47 AM
    Hi,

    I don't know it's my problem or centminmod core problem.

    I build storage server file for download. And all seem going normal. But when I have some large file (~ 2GB) and many download from large file (in same time) => it's make high io disk process. Result of "top" command show wa percent usually in from 15% to 40%. => make sever run slowly and downloading slow too.

    I think this problem come from my server hardware, but I create same server config and install webinoly and easyengine, and tested same large file with many connection => disk io (read and write) going fast, wa percent usually ~ 0.x%, and < 5%

    so what's problem here? my server or centminmod core working way not same webinoly (or easyengine).



    My download code:

    PHP:
    header('Pragma: public');
            
    header('Expires: 0');
            
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            
    header('Cache-Control: private'false);
            
    header('Content-Transfer-Encoding: binary');
            
    header('Content-Disposition: attachment; filename="'.$name.'";');
            
    header('Content-Type: ' $type);
            
    header('Content-Length: ' filesize($file));
            
    header('X-Accel-Redirect: '$filepath);
     
  2. eva2000

    eva2000 Administrator Staff Member

    45,987
    10,446
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,208
    Local Time:
    4:47 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Who is webhost/plans for all the mentioned servers? Same datacenters if they have multiple?

    Is this same server or new server with same config as centmin mod one? If it's cloud vps then hardware can differ as can vps utilisation due to neighbours sharing same vps server.

    Create a third vps with fresh centmin mod install and verify if downloads on that has high disk i/o utilisation as well and test that vps disk performance too.

    I'd test the underlying disk performance of all servers to compare as well. You can use something like sysbench file tests centminmod/centminmod-sysbench

    You are using php to serve large files which isn't optimal but i see you are using X-Accel-Redirect to pass file serving directly to nginx so that's good.
     
  3. babyshark

    babyshark New Member

    20
    5
    3
    Jan 22, 2019
    Ratings:
    +7
    Local Time:
    1:47 AM
    thank @eva2000

    I tested on same server provide, same config, same location and all fresh and new vps.

    I will test more and carefully. Will update result when have new result.

    thank very much

    Any suggest for me about this case, thanks :)