Want more timely Centmin Mod News Updates?
Become a Member

Nginx Setting up aio threads

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Lav, Apr 17, 2020.

  1. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.17.10
    • PHP Version Installed: i.e. 5.6.37, 7.0.31, 7.1.21, 7.2.9
    I have set up aio on; by using
    Code:
    NGINX_IOURING_PATCH_BETA='y'
    . I want to enable aio threads functionalty so for that I need to enter 'aio threads;' in nginxocnf in http field and also do I need to enter
    Code:
    location / {
       root /storage;
       aio threads;
    }
    in the same nginxconf file and after it do I need to recompile nginx or not?
    Do I need to do something else also in order to achieve aio threads functionality?

     
  2. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    On inserting aio threads; under http block in nginxconf, nginx fails to restart.
     
  3. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
    goes in your domain's nginx vhost within server{} for location context you wise to enable for

    But NGINX_IOURING_PATCH_BETA='y' only works if you updated your server's Linux kernel from CentOS 7 3.10 versions to 5.1+
     
  4. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    On inserting this in nginx vhost conf within server {}
    Code:
    location / {
       root /storage;
       aio threads;
    }
    nginx fails to restart but when I only enter
    Code:
    aio threads;
    in nginx vhost conf within server {} then nginx works fine.
    Which one do I need to enter?
    Yes my kernel version is 5.6.xx and aio on; is working fine.
     
  5. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
    output for nginx config test command
    Code (Text):
    nginx -t
     
  6. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    Code:
    nginx -t
    nginx: [emerg] duplicate location "/" in /usr/local/nginx/conf/conf.d/domain.com.conf:59
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    I have placed the code in domain vhostconf after the second server block

    Code:
    server {
    
      server_name domain.com www.domain.com;
    
    location / {
       root /storage;
       aio threads;
    }
    
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
     
  7. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
    you have added a 2nd location / context, you can only have one the existing location / {} context already exists so need to add aio threads line to the existing one
     
  8. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    If I am understanding it right then I only need to add
    Code:
    aio threads;
    instead of
    Code:
    location / {
       root /storage;
       aio threads;
    }
    in the same place where I have inserted
    Code:
    location / {
       root /storage;
       aio threads;
    }
    .
    Is that right?
     
  9. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
    yes but not sure you would want to add root /storage as that overrides all web root path = / for entire site

    maybe better for to move it out of location / {} to own location /storage {} context

    Code (Text):
    location /storage {
      aio threads;
    }
     
  10. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
  11. Lav

    Lav Member

    49
    1
    8
    Feb 23, 2020
    Ratings:
    +1
    Local Time:
    1:10 PM
    1.17.8
    10.3
    Changed it and now nginx is working fine.
    New setup looks like this
    Code:
    server {
    
      server_name domain.com www.domain.com;
    
    location /storage {
      aio threads;
    }
    
    # ngx_pagespeed & ngx_pagespeed handler
    include /usr/local/nginx/conf/pagespeed.conf;
    include /usr/local/nginx/conf/pagespeedhandler.conf;
    include /usr/local/nginx/conf/pagespeedstatslog.conf;
    Is this good? Anyway to check if this is working fine or not?
     
  12. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
  13. pamamolf

    pamamolf Premium Member Premium Member

    3,993
    417
    83
    May 31, 2014
    Ratings:
    +807
    Local Time:
    10:40 AM
    Nginx-1.17.x
    MariaDB 10.3.x
    Are you sure George that can't use it at the main Nginx config under http {

    Don't know why i think that it is possible to set it globally .....
     
  14. eva2000

    eva2000 Administrator Staff Member

    49,347
    11,308
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,591
    Local Time:
    5:40 PM
    Nginx 1.21.x
    MariaDB 10.x
    read Boosting NGINX Performance 9x with Thread Pools as to when aio threads should be used or not - won't help in all situations so you only want to narrow it's usage to a location(s) context