Discover Centmin Mod today
Register Now

PHP-FPM Hugepage and php 7

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by ahmed, May 11, 2017.

  1. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
  2. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod 123.09beta01 automatically enables Hugepages support if you have a Linux kernel that supports it + CentOS 7 and are not using redis server. If you use redis server, hugepages support is disabled for best redis server performance and memory usage.

    the behind the scenes code/discussion on how Centmin Mod 123.09beta01 automatically configures Hugepages if Linux kernel supports Hugepages + PHP 7 + CentOS 7 + no redis is detected https://community.centminmod.com/threads/transparent-huge-pages-tweaks-tools-hptweaks-sh.5340/

    Centmin Mod ain't any ordinary LEMP stack, not many other LEMP stacks would have this feature :D
     
    Last edited: May 11, 2017
    • Winner Winner x 1
  3. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    well, that is great

    so now huge-page is not compatible with Redis
    -now for my wordpress I have

    -memcached
    -Apcu
    -Reis

    - Which is better Redis or PHP huge page? I mean i can repace redis with somthing else but I cant replcae hugepAGE, which is better?


    also what is the best for theses caching:

    -Object cache : APCU?
    -database cache: Memcached?
    -page cache: Memcached instead of disc cache?

    I know there is one fits all, But what is the common practice here

    Best.
     
  4. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    8:49 AM
    1.11
    10.2
    I would recommend:
    • WordPress Cache Enabler Plugin by KeyCDN
    • Data caching use Memcached
    • PHP Opcode - Zend Opcache
     
  5. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    what about object-cache? redis or Apcu?
     
  6. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    8:49 AM
    1.11
    10.2
    Object/Data caching.
     
  7. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    thanks a lot, so I will not use Redis then, so I think enabling Hugepages will be better in that case.
     
    • Like Like x 1
  8. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
  9. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    I also have this in my .ini

    opcache.huge_code_pages=1
     
  10. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    @ahmed what's output for
    Code (Text):
    bash -x /usr/local/src/centminmod/tools/hptweaks.sh
    

    post output to pastebin.com
     
  11. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
  12. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    it's because you have redis server install detected so transparent hugepages is disabeld and set to never in /sys/kernel/mm/transparent_hugepage/enabled
     
  13. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    but I removed redis using this command

    yum remove redis
     
  14. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    does /usr/bin/redis-cli exist ?
    Code (Text):
    ls -lah  /usr/bin/redis-cli
    
     
  15. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
  16. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    ah it's because you have to manually re-enable transparent hugepages after tools/hptweak.sh auto disabled it on redis detection so
    Code (Text):
    echo always > /sys/kernel/mm/transparent_hugepage/enabled
    

    then remove /etc/rc.local entry for
    Code (Text):
    echo never > /sys/kernel/mm/transparent_hugepage/enabled
    

    then re-run tools/hptweaks.sh
     
  17. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    yay,
    now it works, thanks Eva

    Code:
    set vm.nr.hugepages in /etc/sysctl.conf
    vm.overcommit_memory = 1
    vm.nr_hugepages = 8
    
    set system max locked memory limit
    
    /etc/security/limits.conf
    * soft memlock 131072
    * hard memlock 131072
    
    # /etc/security/limits.conf
    #
    #This file sets the resource limits for the users logged in via PAM.
    #It does not affect resource limits of the system services.
    #
    #Also note that configuration files in /etc/security/limits.d directory,
    #which are read in alphabetical order, override the settings in this
    #file in case the domain is the same or more specific.
    #That means for example that setting a limit for wildcard domain here
    #can be overriden with a wildcard setting in a config file in the
    #subdirectory, but a user specific setting here can be overriden only
    #with a user specific setting in the subdirectory.
    #
    #Each line describes a limit for a user in the form:
    #
    #<domain>        <type>  <item>  <value>
    #
    #Where:
    #<domain> can be:
    #        - a user name
    #        - a group name, with @group syntax
    #        - the wildcard *, for default entry
    #        - the wildcard %, can be also used with %group syntax,
    #                 for maxlogin limit
    #
    #<type> can have the two values:
    #        - "soft" for enforcing the soft limits
    #        - "hard" for enforcing hard limits
    #
    #<item> can be one of the following:
    #        - core - limits the core file size (KB)
    #        - data - max data size (KB)
    #        - fsize - maximum filesize (KB)
    #        - memlock - max locked-in-memory address space (KB)
    #        - nofile - max number of open file descriptors
    #        - rss - max resident set size (KB)
    #        - stack - max stack size (KB)
    #        - cpu - max CPU time (MIN)
    #        - nproc - max number of processes
    #        - as - address space limit (KB)
    #        - maxlogins - max number of logins for this user
    #        - maxsyslogins - max number of logins on the system
    #        - priority - the priority to run user process with
    #        - locks - max number of file locks the user can hold
    #        - sigpending - max number of pending signals
    #        - msgqueue - max memory used by POSIX message queues (bytes)
    #        - nice - max nice priority allowed to raise to values: [-20, 19]
    #        - rtprio - max realtime priority
    #
    #<domain>      <type>  <item>         <value>
    #
    
    #*               soft    core            0
    #*               hard    rss             10000
    #@student        hard    nproc           20
    #@faculty        soft    nproc           20
    #@faculty        hard    nproc           50
    #ftp             hard    nproc           0
    #@student        -       maxlogins       4
    
    # End of file
    * soft nofile 262144
    * hard nofile 262144
    nginx soft nofile 262144
    nginx hard nofile 262144
    nobody soft nofile 262144
    nobody hard nofile 262144
    root soft nofile 262144
    root hard nofile 262144
    * soft memlock 131072
    * hard memlock 131072
    
     
    • Like Like x 1
  18. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    excellent, fyi i updated tools/hptweaks.sh in 123.09beta01 with a few bug fixes unrelated to this as well :)
     
  19. ahmed

    ahmed Member

    201
    15
    18
    Feb 21, 2017
    Ratings:
    +21
    Local Time:
    2:49 AM
    do I need to update it and re-run it?
     
  20. eva2000

    eva2000 Administrator Staff Member

    29,016
    6,585
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,775
    Local Time:
    10:49 AM
    Nginx 1.13.x
    MariaDB 5.5
    update yes, re-run no as the bug was related to duplicate memlock entries in
    /etc/security/limits.conf which you don't have