Want to subscribe to topics you're interested in?
Become a Member

PHP-FPM Different Php versions on different vhosts. Possible?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by negative, Sep 14, 2019.

Tags:
  1. negative

    negative Active Member

    360
    40
    28
    Apr 11, 2015
    Ratings:
    +82
    Local Time:
    11:34 PM
    1.9.10
    10.1.11
    Is it possible that to using different php versions on different domains on centminmod beta?

    I need that because my laravel portal software doesn't support the php 7.3 but i want to use php 7.3 on my another domain which support that.

    Thanks
     
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,583
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    11:34 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Hello

    It is something that is planned to do but not ready yet ....

    In my opinion it is the most important feature at the moment for Centminmod as it will provide as a lot of flexibility....
     
    Last edited: Sep 14, 2019
    • Agree Agree x 2
  3. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah multiple PHP versions is on Centmin Mod to do list just not ready for public release/support yet

    preview of one of the many ways it could be implemented at PHP-FPM - addons/php71.sh - Multiple PHP-FPM Versions Work Preview but note multiple PHP versions means more cpu and memory usage too so if you have one PHP-FPM version using 1-2GB memory and 4 cpus, having 2 or 3 more PHP-FPM versions means potentially using 2x3 = 6GB memory and 4x3 = 12 cpus. So if your server doesn't have memory or cpu resources to support multiple PHP-FPM versions, PHP performance will suffer more than the gains you made by using PHP 7.3+ for some web apps and not others too.

    FYI, Centmin Mod 123.09beta01's PHP-FPM with PHP_PGO='y' enabled will have PHP performance once major version above distro YUM PHP versions. So Centmin Mod PHP-FPM 7.2.2 + PGO enabled has performance close to standard YUM PHP 7.3. So if you used Centmin Mod PHP + PGO enabled 7.2.22, it will be performing close to other distro's PHP 7.3 :)
     
    Last edited: Sep 14, 2019
  4. negative

    negative Active Member

    360
    40
    28
    Apr 11, 2015
    Ratings:
    +82
    Local Time:
    11:34 PM
    1.9.10
    10.1.11
    It looks bad idea then due memory usage.
    Laravel modify will be better choice for me.


    Is php 7.3 PGO better than all ?
    I look your benchmarks but i see that you tested them with RC versions of php 7.3

    Actually i'm going to upgrade php 7.3 with PGO

    Also, i'm using the server on ESXI main server which using Intel E2650 CPU.
    So, should i add the GCCINTEL_PHP='y' parameter too for better results ? or PGO enough?
     
  5. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    PHP 7.3 + PGO is as fast as PHP 7.4 YUM distro and PHP 7.4 + PGO is faster than any PHP 7.4 YUM distro version :D

    Might be too old as E5-2650v1 is Sandybridge cpu and won't have AVX2 cpu support which is what makes PHP 7.3+ and 7.4+ faster as it uses AVX2 when the cpu supports it. AVX2 is supported on Intel Haswell or newer cpus including AMD EPYC/Ryzen too Advanced Vector Extensions - Wikipedia

    PHP + PGO will be faster, but a cpu with AVX2 support will make PHP 7.3+ even faster. But as your cpu E5-2650v1 doesn't have AVX2 support, PHP 7.3+ won't be as fast as it can be anyway, so even PHP 7.2 + PGO would be fast enough for a E5-2650v1
     
  6. negative

    negative Active Member

    360
    40
    28
    Apr 11, 2015
    Ratings:
    +82
    Local Time:
    11:34 PM
    1.9.10
    10.1.11
    So what is best choice for my CPU?
    I understand that 7.2 PGO and GCCINTEL_PHP='y' are ideal settings for me ?

    If i can't take the advantages of 7.3+ PGO with Intel, 7.2 PGO with Intel is enough for me ?
     
  7. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    PHP_PGO='y' implies GCCINTEL_PHP='y' already
     
  8. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Intell Haswell or newer is Xeon E3-12xx v3 (Haswell) or newer, Xeon E5-26xx v4 (Broadwell) or Intel Xeon Silver/Gold/Platinum Scalable Skylake cpus

    to check if avx2 is supported run on non-openvz systems command below and check cpu flags for avx2
    Code (Text):
    lscpu

    or openvz systems
    Code (Text):
    cat /proc/cpuinfo

    example is this on latest generation Intel Xeon E-2276G Coffelake cpu 6 core/12 cpu thread server under cpu flags there's avx2 support
    Code (Text):
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                12
    On-line CPU(s) list:   0-11
    Thread(s) per core:    2
    Core(s) per socket:    6
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             GenuineIntel
    CPU family:            6
    Model:                 158
    Model name:            Intel(R) Xeon(R) E-2276G CPU @ 3.80GHz
    Stepping:              10
    CPU MHz:               799.938
    CPU max MHz:           4900.0000
    CPU min MHz:           800.0000
    BogoMIPS:              7584.00
    Virtualization:        VT-x
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              256K
    L3 cache:              12288K
    NUMA node0 CPU(s):     0-11
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear spec_ctrl intel_stibp flush_l1d
    

    this is on AMD Ryzen 3600 (AMD Zen2) with avx2
    Code (Text):
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                12
    On-line CPU(s) list:   0-11
    Thread(s) per core:    2
    Core(s) per socket:    6
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             AuthenticAMD
    CPU family:            23
    Model:                 113
    Model name:            AMD Ryzen 5 3600 6-Core Processor
    Stepping:              0
    CPU MHz:               2200.000
    CPU max MHz:           3600.0000
    CPU min MHz:           2200.0000
    BogoMIPS:              7186.94
    Virtualization:        AMD-V
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              512K
    L3 cache:              16384K
    NUMA node0 CPU(s):     0-11
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl xtopology nonstop_tsc extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_l2 cpb cat_l3 cdp_l3 hw_pstate sme retpoline_amd ssbd ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip overflow_recov succor smca
    

    and AMD Ryzen 3800X 8C/16T cpu
    Code (Text):
    lscpu
    Architecture:          x86_64
    CPU op-mode(s):        32-bit, 64-bit
    Byte Order:            Little Endian
    CPU(s):                16
    On-line CPU(s) list:   0-15
    Thread(s) per core:    2
    Core(s) per socket:    8
    Socket(s):             1
    NUMA node(s):          1
    Vendor ID:             AuthenticAMD
    CPU family:            23
    Model:                 113
    Model name:            AMD Ryzen 7 3800X 8-Core Processor
    Stepping:              0
    CPU MHz:               2800.000
    CPU max MHz:           3900.0000
    CPU min MHz:           2200.0000
    BogoMIPS:              7785.17
    Virtualization:        AMD-V
    L1d cache:             32K
    L1i cache:             32K
    L2 cache:              512K
    L3 cache:              16384K
    NUMA node0 CPU(s):     0-15
    Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl xtopology nonstop_tsc extd_apicid aperfmperf eagerfpu pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_l2 cpb cat_l3 cdp_l3 hw_pstate sme retpoline_amd ssbd ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif umip overflow_recov succor smca
    

    Yes look forward to some Centmin Mod PHP and other benchmark comparisons on Intel Xeon E-2276G 6C/12T vs AMD Ryzen 3600 6C/12T vs AMD Ryzen 3800X 8C/16T dedicated servers soon ;)
    PHP 7.3 + PGO will still be faster than PHP 7.2 + PGO in theory, just if you have 2 web apps where you want PHP 7.2 and 7.3 supported by multiple PHP versions, you won't have that in Centmin Mod right now, so PHP 7.2 + PGO would fit you needs especially as PHP 7.3 won't be as fast with a cpu without AVX2 support.
     
  9. negative

    negative Active Member

    360
    40
    28
    Apr 11, 2015
    Ratings:
    +82
    Local Time:
    11:34 PM
    1.9.10
    10.1.11
    cat /proc/cpuinfo

    And you are right, i see just AVX, not AVX2.

    So, i have no full advantages of 7.3+ PGO at this time.

    And currently, i'm using 7.1 PGO and it is not reasonable run 7.1 PGO & 7.3 PGO both on the same webserver. Probably, i will go to separate my CMS and forum to different virtual servers. :/

    Code (Text):
    processor       : 31
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 45
    model name      : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
    stepping        : 7
    microcode       : 0x710
    cpu MHz         : 1995.000
    cache size      : 20480 KB
    physical id     : 62
    siblings        : 1
    core id         : 0
    cpu cores       : 1
    apicid          : 62
    initial apicid  : 62
    fpu             : yes
    fpu_exception   : yes
    cpuid level     : 13
    wp              : yes
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm epb tsc_adjust dtherm ida arat pln pts
    bogomips        : 3990.00
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 42 bits physical, 48 bits virtual
    power management:
     
  10. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  11. pamamolf

    pamamolf Premium Member Premium Member

    3,583
    345
    83
    May 31, 2014
    Ratings:
    +667
    Local Time:
    11:34 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Didn't thought that memory and cpu will increase per version so much ..... :(

    I thought that it will be like giving 4 cores and 4 gb ram for php and i will be able to have different versions of php and domains will share the above resources only when needed ....

    Maybe it will be better to use one php version at least for high traffic sites that will need all the server power ... :)
     
  12. eva2000

    eva2000 Administrator Staff Member

    42,375
    9,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,746
    Local Time:
    7:34 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    if each site has different PHP version, and each site is heavy PHP users, then yes you'd increase respective PHP versions resource usage for cpu and memory by a factor that is linked to how many PHP versions are running.

    Reason is each PHP version has to have it's own separate PHP-FPM pools and PHP-FPM master processes and own Zend Opcache cache. So yes if you allocated 512MB to each Zend Opcache cache, and have 5x PHP versions running, you'd need a maximum of 5x 512MB = 2.5GB of memory to service all 5x PHP version's Zend Opcache cache requirements at the maximum end. And if each PHP version's master/children etc use 1GB of memory, than 5x PHP versions require 5x1 = 5GB memory.

    So in total for each PHP version + Zend Opcache memory allocation, the theoretical max memory used is 5x (1+0.5) = 7.5GB of memory.

    If you have each PHP version using 2GB of memory and 1GB Zend Opcache memory allocation/usage, then total memory usage would be 5x (2+1) = 15GB of memory.

    That doesn't count cpu usage each PHP version can use i.e. 4 cpus per PHP version would mean in theory, 5x4 = 20 cpu utilisation or 2000% cpu utilisation.

    This is ps output of cpu and memory usage of idle server with multiple PHP-FPM versions installed - remember this is idle right now so memory usage increases with usage.

    This Centmin Mod 123.09beta01 server with multiple PHP-FPM versions has 32GB of memory available though.
    Code (Text):
    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    
    root     14620  0.0  0.0 1366368 14480 ?       Ss   Aug31   0:12 php-fpm: master process (/etc/opt/remi/php72/php-fpm.conf)
    nginx    14621  0.0  0.0 1366632 10840 ?       S    Aug31   0:00  \_ php-fpm: pool php72-www
    nginx    14622  0.0  0.0 1366632 10840 ?       S    Aug31   0:00  \_ php-fpm: pool php72-www
    nginx    14623  0.0  0.0 1366632 10884 ?       S    Aug31   0:00  \_ php-fpm: pool php72-www
    nginx    14624  0.0  0.0 1366632 10888 ?       S    Aug31   0:00  \_ php-fpm: pool php72-www
    nginx    14625  0.0  0.0 1366632 10888 ?       S    Aug31   0:00  \_ php-fpm: pool php72-www
    nginx    20363  0.0  0.0 1366632 11080 ?       S    Sep10   0:00  \_ php-fpm: pool php72-www
    root     21600  0.0  0.0 1372192 25680 ?       Ss   Sep12   0:02 php-fpm: master process (/etc/opt/remi/php74/php-fpm.conf)
    nginx    21607  0.0  0.0 1372192 11608 ?       S    Sep12   0:00  \_ php-fpm: pool php74-www
    nginx    21608  0.0  0.0 1372192 11372 ?       S    Sep12   0:00  \_ php-fpm: pool php74-www
    nginx    21609  0.0  0.0 1372192 11620 ?       S    Sep12   0:00  \_ php-fpm: pool php74-www
    nginx    21610  0.0  0.0 1372192 11372 ?       S    Sep12   0:00  \_ php-fpm: pool php74-www
    nginx    21611  0.0  0.0 1372192 11376 ?       S    Sep12   0:00  \_ php-fpm: pool php74-www
    root     21652  0.0  0.0 1375836 25540 ?       Ss   Sep12   0:02 php-fpm: master process (/etc/opt/remi/php73/php-fpm.conf)
    nginx    21654  0.0  0.0 1375996 11648 ?       S    Sep12   0:00  \_ php-fpm: pool php73-www
    nginx    21655  0.0  0.0 1375996 11616 ?       S    Sep12   0:00  \_ php-fpm: pool php73-www
    nginx    21656  0.0  0.0 1375996 11844 ?       S    Sep12   0:00  \_ php-fpm: pool php73-www
    nginx    21657  0.0  0.0 1375996 11552 ?       S    Sep12   0:00  \_ php-fpm: pool php73-www
    nginx    21658  0.0  0.0 1376000 11524 ?       S    Sep12   0:00  \_ php-fpm: pool php73-www
    root     21670  0.0  0.0 1359208 20968 ?       Ss   Sep12   0:02 php-fpm: master process (/etc/opt/remi/php71/php-fpm.conf)
    nginx    21671  0.0  0.0 1359472 10016 ?       S    Sep12   0:00  \_ php-fpm: pool php71-www
    nginx    21672  0.0  0.0 1359472 9988 ?        S    Sep12   0:00  \_ php-fpm: pool php71-www
    nginx    21673  0.0  0.0 1359472 9988 ?        S    Sep12   0:00  \_ php-fpm: pool php71-www
    nginx    21674  0.0  0.0 1359472 9980 ?        S    Sep12   0:00  \_ php-fpm: pool php71-www
    nginx    21675  0.0  0.0 1359472 9976 ?        S    Sep12   0:00  \_ php-fpm: pool php71-www
    root     21687  0.0  0.0 1325396 20548 ?       Ss   Sep12   0:02 php-fpm: master process (/etc/opt/remi/php70/php-fpm.conf)
    nginx    21688  0.0  0.0 1325528 10324 ?       S    Sep12   0:00  \_ php-fpm: pool php70-www
    nginx    21689  0.0  0.0 1325528 10304 ?       S    Sep12   0:00  \_ php-fpm: pool php70-www
    nginx    21690  0.0  0.0 1325528 10304 ?       S    Sep12   0:00  \_ php-fpm: pool php70-www
    nginx    21691  0.0  0.0 1325528 10292 ?       S    Sep12   0:00  \_ php-fpm: pool php70-www
    nginx    21692  0.0  0.0 1325528 10272 ?       S    Sep12   0:00  \_ php-fpm: pool php70-www
    root      8926  0.0  0.0 1205708 8420 ?        S<s  Sep12   0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf)
    
     
    • Agree Agree x 1
    • Informative Informative x 1