Want more timely Centmin Mod News Updates?
Become a Member

Featured Nginx Guide To GCC & Clang Compiler Selection For Nginx Installs

Discussion in 'Centmin Mod Insights' started by eva2000, Jan 15, 2018.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    53,818
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    3:02 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+

    Guide To GCC & Clang Compiler Selection For Nginx Installs



    Centmin Mod 123.09beta01 LEMP stack can allow users to optionally select their own choice of compilers for Nginx and PHP-FPM. Below is example for Nginx where you can choose between native CentOS GCC version, GCC 5.3.1, GCC 6.3.1, GCC 7.2.1, Clang 3.4.2, Clang 4.0.1 and GCC 8.0 and Clang 5.0 & Clang 6.0.

    As at December 3, 2021, latest is using GCC 9 and GCC 10 and soon GCC 11

    As discussed here, depending on pairing of compiler and specific cpu model, you can get better Nginx or PHP-FPM performance usually between 5-10%. Which may offset some of the performance loss due to Linux Kernel Page Table Isolation updates to fix Meltdown/Spectre vulnerabilities :)


    Below is a list of persisent config file /etc/centminmod/custom_config.inc variables controlling which compiler and version is used for GCC or Clang compilers with Nginx + switching from default LibreSSL 2.6.4 to OpenSSL 1.1.0g. You set these variables BEFORE you run centmin.sh menu option 4 to recompile your Nginx versions.

    You can check nginx -V output's built by line for details.

    For GCC 10 - current defaults
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    DEVTOOLSETNINE='n'
    DEVTOOLSETTEN='y'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 9 - current defaults
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    DEVTOOLSETNINE='y'
    DEVTOOLSETTEN='n'
    NGINX_DEVTOOLSETGCC='y'
    


    For GCC 8.0 - note experimental and not enabled in public Centmin Mod 123.09beta01 code yet and undergoing private testing right now.
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='y'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 7.2.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='y'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 6.3.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='y'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 5.3.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 4.8.5 native CentOS 7.4 OS provided
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='n'
    

    For Clang 3.4.2
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='n'
    

    For Clang 4.0.1 add CLANG_FOUR='y'
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG_FOUR='y'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For Clang 5.0.1 add CLANG_FIVE='y' - note experimental and not enabled in public Centmin Mod 123.09beta01 code yet and undergoing private testing right now. Updated Clang 5.0.1 support.
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG_FIVE='y'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For Clang 6.0.0 add CLANG_SIX='y' - note experimental and not enabled in public Centmin Mod 123.09beta01 code yet and undergoing private testing right now
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG_SIX='y'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

     
    Last edited: Dec 3, 2021
  2. eva2000

    eva2000 Administrator Staff Member

    53,818
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    3:02 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Doing some quick Siege static web serving benchmarks on 2 cpu thread OpenVZ VPS server which sports an Intel E5-1650v3 @3.50Ghz processor running Centmin Mod 123.09beta01 on CentOS 7.4 64bit.

    Siege test paramaters and changing comment marker for each respective GCC version tested
    Code (Text):
    comment='gcc8'
    siege -b -d1s -c100 -r500 -m $comment http://localhost | tee "siege-${comment}-$(date +"%d%m%y-%H%M%S").log"
    

    Results running each Nginx + GCC pairing through 3x runs of Siege benchmarking and average of 3 runs shown.

    Notes:
    • These are just quick tests as the results aren't entirely accurate as you probably need to do more than 3x runs and being on OpenVZ virtualized server means you're subject to noisy neighbours and resource contention still.
    • Do not take these results as gospel as performance depends on your compiler + cpu model pairing. You may have a different cpu model and that may perform differently to below results. Finding the right compiler + cpu pairing is part of the fun :D

    siege-chart-gcc8-nginx-140118-01.png
     
  3. eva2000

    eva2000 Administrator Staff Member

    53,818
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    3:02 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    devtoolset-7 has updated from GCC 7.2.1 to GCC 7.3.1 GCC 7.3.1 update :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,818
    12,160
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,712
    Local Time:
    3:02 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Updated Clang 5.0.1 support.

    For Clang 5.0.1 add CLANG_FIVE='y'
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG_FIVE='y'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

     
Thread Status:
Not open for further replies.