The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Apache help looking for seasoned assistance

Discussion in 'Workarounds and Optimization' started by Mindlash, Oct 20, 2014.

  1. Mindlash

    Mindlash Well-Known Member

    Joined:
    Jul 7, 2003
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    I see threads similar to this here and there, with most ending with individuals saying 'PM me for my contacts' or cPanel saying 'Visit our catalog'. That's all well and good, but I would like to be more specific about my needs, and if you feel you are the right fit, or know someone who is, please kindly have them take a peek at this thread :)

    Level of urgency: 8 (out of 10, being the highest)

    Quick History

    I have 173 /etc/localdomains, but at any given time only have about 10 or so producing any amount of traffic. For the small amount of traffic I get, the server can come to a crawl with high CPU and Memory usage. The configurations below are what I have now, that have combated higher CPU and Memory usage, but still I know are not optimized for my server.

    The end result is that I need a speedy responsive server that doesn't die every other day (early hours of the morning) for no reason, and can keep up with... maybe 10 concurrent connections without spiking to a 17 load.


    Here are my server specs:

    Linux 2.6.32-358.2.1.el6.i686 #1 SMP Tue Mar 12 21:42:46 UTC 2013 i686 i686 i386 GNU/Linux
    Version: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_fcgid/2.3.9 Server MPM: event
    Cpanel::Easy::Apache v3.26.7 rev9999
    CENTOS 6.5 i686 vmware
    WHM 11.44.1 (build 17)
    PHP 5.5.16 (cli)
    Zend Engine v2.5.0
    with the ionCube PHP Loader v4.6.1
    MySQL version: 5.5.37-cll

    I used SysAlly's cpHstack for php-fpm for MPM Event

    Current meminfo (nice and low load of course...)

    Code:
    top - 09:17:37 up 65 days, 23:59,  8 users,  load average: 0.73, 1.22, 1.34
    Tasks: 170 total,   1 running, 168 sleeping,   0 stopped,   1 zombie
    Cpu(s):  1.4%us,  3.6%sy,  0.0%ni, 94.7%id,  0.0%wa,  0.0%hi,  0.3%si,  0.0%st
    Mem:   8181200k total,  7270404k used,   910796k free,   418896k buffers
    Swap:  4161528k total,    53780k used,  4107748k free,  3652880k cached
    
    # /etc/my.cnf

    Code:
    [mysql]
    # CLIENT #
    port                           = 3306
    socket                         = /var/lib/mysql/mysql.sock
    
    [mysqld]
    # GENERAL #
    user                           = mysql
    default_storage_engine         = MyISAM
    socket                         = /var/lib/mysql/mysql.sock
    pid_file					   = /var/lib/mysql/myserver.com.pid
    # MyISAM #
    key_buffer_size                = 2G
    myisam_recover                 = FORCE,BACKUP
    # SAFETY #
    max_allowed_packet             = 16M
    max_connect_errors             = 1000000
    sql_mode                       = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE
    # DATA STORAGE #
    datadir                        = /var/lib/mysql/
    # CACHES AND LIMITS #
    tmp_table_size                 = 64M
    max_heap_table_size            = 64M
    query_cache_type               = 1
    query_cache_size               = 8M
    max_connections                = 500
    thread_cache_size              = 50
    table_definition_cache         = 4096
    table_open_cache               = 10540
    # INNODB #
    innodb_flush_method            = O_DIRECT
    innodb_log_files_in_group      = 2
    innodb_log_file_size           = 32M
    innodb_flush_log_at_trx_commit = 1
    innodb_file_per_table          = 1
    innodb_buffer_pool_size        = 1M
    # LOGGING #
    log_error					   = /var/lib/mysql/myserver.com.err 
    log_queries_not_using_indexes  = 1
    slow_query_log                 = 1
    slow_query_log_file            = /var/lib/mysql/mysql-slow.log
    max_allowed_packet		       = 268435456
    Portions of php.ini

    Code:
    [PHP]
    max_execution_time = 30  
    max_input_time = 60
    max_input_vars = 5000
    memory_limit = 32M
    
    error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
    
    extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212"
    zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.5.so"
    extension = xcache.so
    [xcache]
    xcache.shm_scheme =        "mmap"
    xcache.size  =               512M
    xcache.count =                 2
    xcache.slots =                8K
    xcache.ttl   =                 0
    xcache.gc_interval =           0
    xcache.var_size  =            16M
    xcache.var_count =             2
    xcache.var_slots =            8K
    xcache.var_ttl   =             0
    xcache.var_maxttl   =          0
    xcache.var_gc_interval =     300
    xcache.var_namespace_mode =    0
    xcache.var_namespace =        ""
    xcache.readonly_protection = Off
    xcache.mmap_path =    "/dev/zero"
    xcache.coredump_directory =   "/tmp/xcache/"
    xcache.coredump_type =         0
    xcache.disable_on_crash =    Off
    xcache.experimental =        Off
    xcache.cacher =               On
    xcache.stat   =               On
    xcache.optimizer =            On
    xcache.coverager_autostart =  On
    xcache.coveragedump_directory = "/tmp/xcache/"
    

    # ulimit -a

    Code:
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 63796
    max locked memory       (kbytes, -l) 64
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 1024
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 10240
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 63796
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    
    Current php Compile config:

    './configure' '--disable-fileinfo' '--disable-posix' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-fastcgi' '--enable-fpm' '--enable-ftp' '--enable-gd-native-ttf' '--enable-intl' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-wddx' '--enable-zip' '--prefix=/usr/local' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-enchant=/usr' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-icu-dir=/usr' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-png-dir=/usr' '--with-pspell' '--with-snmp' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr'


    Apache Loaded Modules:

    core.c, event.c, http_core.c, mod_access_compat.c, mod_actions.c, mod_alias.c, mod_auth_basic.c, mod_authn_core.c, mod_authn_file.c, mod_authz_core.c, mod_authz_groupfile.c, mod_authz_host.c, mod_authz_user.c, mod_autoindex.c, mod_bw.c, mod_bwlimited.c, mod_cgi.c, mod_dbd.c, mod_deflate.c, mod_dir.c, mod_env.c, mod_expires.c, mod_fcgid.c, mod_file_cache.c, mod_filter.c, mod_headers.c, mod_include.c, mod_info.c, mod_log_config.c, mod_logio.c, mod_mime.c, mod_negotiation.c, mod_proxy.c, mod_proxy_connect.c, mod_proxy_fcgi.c, mod_proxy_http.c, mod_rewrite.c, mod_security2.c, mod_setenvif.c, mod_slotmem_shm.c, mod_so.c, mod_socache_dbm.c, mod_socache_shmcb.c, mod_ssl.c, mod_status.c, mod_suexec.c, mod_unique_id.c, mod_unixd.c, mod_userdir.c,


    Apache /whm-server-status

    Code:
    Current Time: Monday, 20-Oct-2014 08:59:51 EDT
    Restart Time: Sunday, 19-Oct-2014 16:12:34 EDT
    Parent Server Config. Generation: 136
    Parent Server MPM Generation: 135
    Server uptime: 16 hours 47 minutes 17 seconds
    Server load: 1.00 0.99 0.96
    Total accesses: 72507 - Total Traffic: 1.9 GB
    CPU Usage: u80.36 s39.52 cu.09 cs.53 - .199% CPU load
    1.2 requests/sec - 32.9 kB/second - 27.4 kB/request
    2 requests currently being processed, 190 idle workers
    PID	Connections	Threads	Async connections
    total	accepting	busy	idle	writing	keep-alive	closing
    3245	3	yes	0	64	0	0	3
    3246	5	yes	2	62	0	1	4
    3247	2	yes	0	64	0	1	1
    Sum	10	 	2	190	0	2	8

    Apache /server-info

    Code:
    Server Version: Apache/2.4.10 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_fcgid/2.3.9
    Server Built: Sep 6 2014 15:26:15
    Server loaded APR Version: 1.5.1
    Compiled with APR Version: 1.5.1
    Server loaded APU Version: 1.5.3
    Compiled with APU Version: 1.5.3
    Timeouts: connection: 100    keep-alive: 4
    [B]MPM Name: event[/B]
    MPM Information: Max Daemons: 10 Threaded: yes Forked: yes
    Server Architecture: 32-bit

    PHP-FPM information ###########################:

    #/usr/local/etc/php-fpm.conf

    Code:
    [global]
    pid = /var/run/php-fpm/php-fpm.pid
    error_log = /var/log/php-fpm.log
    process.max = 128
    [nobody]
    user = nobody
    group = nobody
    listen = 127.0.0.1:9000
    pm = ondemand
    pm.max_children = 2
    pm.process_idle_timeout = 20s
    pm.max_requests = 0
    pm.status_path = /fpm-status
    ping.path = /ping
    slowlog = /var/log/php-fpm/$pool.log.slow
    request_slowlog_timeout = 10s
    php_admin_value[memory_limit] = 16M
    include=/opt/xstack/cphstack/php-fpm.pool.d/*.conf
    #/opt/xstack/cphstack/php-fpm.pool.d/bob.conf [Example Vhost That Crawls with traffic]

    Code:
    [bob]
    user = bob
    group = bob
    listen = /var/run/php-fpm/bob.sock
    listen.mode = 0666
    pm = ondemand
    pm.max_children = 2
    pm.process_idle_timeout = 1s;
    pm.max_requests = 200
    Example vHost portion of httpd.conf

    Code:
    <VirtualHost 192.81.81.81:80>
        ServerName bob.com 
        ServerAlias www.bob.com
        DocumentRoot /home/bob/public_html
            <IfModule mod_proxy_fcgi.c>
                    ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php-fpm/bob.sock|fcgi://localhost/home/bob/public_html/
            </IfModule> 
        ServerAdmin webmaster@bob.com
        UseCanonicalName Off
        CustomLog /usr/local/apache/domlogs/bob.com combined
        CustomLog /usr/local/apache/domlogs/bob.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
        UserDir enabled bob
        <IfModule mod_include.c>
            <Directory "/home/bob/public_html">
                SSILegacyExprParser On
            </Directory>
        </IfModule>
        <IfModule !mod_disable_suexec.c>
            <IfModule !mod_ruid2.c>
                SuexecUserGroup bob bob
            </IfModule>
        </IfModule>
        <IfModule mod_ruid2.c>
            RMode config
            RUidGid bob bob
        </IfModule>
        <IfModule itk.c>
            AssignUserID bob bob
        </IfModule>
        ScriptAlias /cgi-bin/ /home/bob/public_html/cgi-bin/
    </VirtualHost>


    A simple stress test, such as:

    Code:
    #ab -n 200 -c 50 bob.com
    Takes about 40 seconds to complete, and can raise the server load upwards of 10. Tests are performed on both wordpress and silverstripe sites. Some with additional caching, some not. Some with CloudFlare CDN, some not.

    Any assistance to this would be GREATLY appreciated.

    - - - Updated - - -

    I should also note, I've not been able to upgrade cpanel due to a conflict:

    Running `/usr/local/cpanel/scripts/updatenow --upcp --log=/var/cpanel/updatelogs/update.1413778561.log` failed, exited with code 1 (signal = 0)

    Results in tons of these:
    file /usr/include/mysql/mysql/XYZ.h from install of MySQL55-devel-5.5.37-2.cp1136.i386 conflicts with file from package MySQL56-devel-5.6.17-1.cp1142.i386

    Lastley, with php-fpm I'm unable to actually get the /status (or in my case /fpm-status) to work, making it more difficult to troubleshoot php-FPM as a whole.
     
    #1 Mindlash, Oct 20, 2014
    Last edited: Oct 20, 2014
  2. Mindlash

    Mindlash Well-Known Member

    Joined:
    Jul 7, 2003
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    80 Views, no thoughts? ;)

    Mods: Is this the correct forum for this topic? Should it be moved to a more appropriate location for better performance?

    Thanks.
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    201
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes. :)

    I dare not mention the AppCat I suppose, but, you might have more luck with this sort of full server administration request over at WHT, as one example. Or even here: /http://cpxstack.sysally.net/documentation.htm
     
  4. Mindlash

    Mindlash Well-Known Member

    Joined:
    Jul 7, 2003
    Messages:
    78
    Likes Received:
    0
    Trophy Points:
    6
    Advice taken. Posted at WHT. the documentation URL is for cpXstack vs Hstack... I've reached out to them before and have gotten zero assistance. :/

    Thanks Infopro.
     
Loading...

Share This Page