Trying to use APC but it seems to be clearing out?

Discussion in 'PHP' started by NUTNDUN, Jun 17, 2011.

  1. webizen

    webizen New Member

    It is better set PHP_LSAPI_MAX_REQUESTS=500 or 1000. You don't want a child php process just serves one request and exits. Max Idle time by default (not set) is -1 (server never kill the parent PHP process). Another possibility of opcode cache reset is server restart (by itself). You can verify the server uptime in realtime stats and see if it does restart often (uptime is short). if so, you need to check error.log around the time it restarts for clue.

  2. NiteWave

    NiteWave Administrator

    also, you change the default setting
    PHP_LSAPI_CHILDREN=35
    to
    PHP_LSAPI_CHILDREN=50

    then have you changed
    Max Connections:35
    as well? should change it to 50 as well. these 2 settings should match
  3. NUTNDUN

    NUTNDUN New Member

    Ok, something is definitely restarting the litespeed server. Just have to figure out what and if anyone has any tips on how to go about that I am all ears. Here is what is in the info log from the litespeed admin panel after a recent reset.

    2011-06-23 18:04:59.268 NOTICE Server Restart Request via Signal...
    2011-06-23 18:04:59.269 NOTICE [PID: 13711]: start cgid: 7379, /usr/local/lsws/bin/lscgid
    2011-06-23 18:04:59.269 NOTICE [Child: 13715] Start shutting down gracefully ...
    2011-06-23 18:04:59.269 INFO Pass listener 127.0.0.1:443.
    2011-06-23 18:04:59.269 INFO Pass listener 127.0.0.1:80.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.72:443.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.72:80.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.73:443.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.73:80.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.74:443.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.74:80.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.75:443.
    2011-06-23 18:04:59.269 INFO Pass listener 173.199.147.75:80.
    2011-06-23 18:04:59.269 INFO Pass listener *:7080.
    2011-06-23 18:04:59.270 INFO Stop listener 127.0.0.1:443.
    2011-06-23 18:04:59.270 INFO Stop listener 127.0.0.1:80.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.72:443.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.72:80.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.73:443.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.73:80.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.74:443.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.74:80.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.75:443.
    2011-06-23 18:04:59.270 INFO Stop listener 173.199.147.75:80.
    2011-06-23 18:04:59.270 INFO Stop listener *:7080.
    2011-06-23 18:04:59.513 NOTICE Your License key will expire in 14 days
    2011-06-23 18:04:59.513 NOTICE Loading LiteSpeed/4.1.1 Enterprise ...
    2011-06-23 18:04:59.715 NOTICE [ADMIN] server socket: uds://usr/local/lsws/admin/tmp/admin.sock.7689
    2011-06-23 18:04:59.715 NOTICE Loading configuration from /usr/local/lsws/conf/httpd_config.xml ...
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [127.0.0.1:443]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [127.0.0.1:80]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.72:443]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.72:80]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.73:443]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.73:80]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.74:443]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.74:80]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.75:443]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [173.199.147.75:80]
    2011-06-23 18:04:59.716 NOTICE Recovering server socket: [*:7080]
    2011-06-23 18:04:59.716 NOTICE [config] chroot is disabled.
    2011-06-23 18:04:59.716 INFO old priority: -19, new priority: -19
    2011-06-23 18:04:59.716 INFO [config:server:basic] For better obscurity, server version number is hidden in the response header.
    2011-06-23 18:04:59.737 NOTICE [PID: 7404]: start cgid: 7407, /usr/local/lsws/bin/httpd
    2011-06-23 18:04:59.737 WARN [config:server:listener] No listener is available for normal virtual host!
    2011-06-23 18:04:59.737 NOTICE The maximum number of file descriptor limit is set to 6000.
    2011-06-23 18:04:59.738 NOTICE [config] Cache function requires a 2-CPU license or above.
    2011-06-23 18:04:59.738 INFO Processing config file: /usr/local/apache/conf/includes/pre_main_global.conf
    2011-06-23 18:04:59.738 INFO Processing config file: /usr/local/apache/conf/includes/pre_main_2.conf
    2011-06-23 18:04:59.738 INFO Processing config file: /usr/local/apache/conf/php.conf
    2011-06-23 18:04:59.738 INFO Processing config file: /usr/local/apache/conf/includes/errordocument.conf
    2011-06-23 18:04:59.738 INFO Processing config file: /usr/local/apache/conf/modsec2.conf
    2011-06-23 18:04:59.746 INFO Processing config file: /usr/local/apache/conf/modsec2.user.conf
    2011-06-23 18:04:59.750 INFO Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_global.conf
    2011-06-23 18:04:59.750 INFO Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_global.conf
    2011-06-23 18:04:59.750 INFO Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_2.conf
    2011-06-23 18:04:59.750 INFO Processing config file: /usr/local/apache/conf/includes/pre_virtualhost_2.conf
    2011-06-23 18:04:59.751 INFO Processing config file: /usr/local/apache/conf/includes/post_virtualhost_global.conf
    2011-06-23 18:04:59.751 INFO Processing config file: /usr/local/apache/conf/includes/post_virtualhost_global.conf
    2011-06-23 18:04:59.751 INFO Processing config file: /usr/local/apache/conf/includes/post_virtualhost_2.conf
    2011-06-23 18:04:59.751 INFO Processing config file: /usr/local/apache/conf/includes/post_virtualhost_2.conf
    2011-06-23 18:04:59.756 NOTICE litespeed (7404) is ready
    2011-06-23 18:04:59.757 NOTICE [child: 7409] Successfully change current user to nobody
    2011-06-23 18:04:59.757 NOTICE [Child: 7409] Core dump is enabled.
    2011-06-23 18:04:59.757 NOTICE [Child: 7409] Setup swapping space...
    2011-06-23 18:04:59.757 NOTICE [Child: 7409] LiteSpeed/4.1.1 Enterprise starts successfully!
    2011-06-23 18:04:59.757 NOTICE [AutoRestarter] new child process with pid=7409 is forked!
    2011-06-23 18:04:59.770 NOTICE New litespeed process is ready, litespeed (13715) stops listeners
    2011-06-23 18:04:59.770 INFO Stop listener 127.0.0.1:443.
    2011-06-23 18:04:59.770 INFO Stop listener 127.0.0.1:80.
    2011-06-23 18:04:59.770 INFO Stop listener 173.199.147.72:443.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.72:80.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.73:443.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.73:80.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.74:443.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.74:80.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.75:443.
    2011-06-23 18:04:59.771 INFO Stop listener 173.199.147.75:80.
    2011-06-23 18:04:59.771 INFO Stop listener *:7080.
    2011-06-23 18:04:59.771 NOTICE [Child: 13715] Shut down successfully!
    2011-06-23 18:04:59.771 NOTICE [lsphp5] stop worker processes
    2011-06-23 18:04:59.774 NOTICE [AutoRestarter] cleanup children processes and unix sockets of process with pid=13715 !
    2011-06-23 18:04:59.774 INFO [CLEANUP] Clean up child process with pid: 13887
    2011-06-23 18:04:59.874 NOTICE [AutoRestarter] child process with pid=13715 exited with status=0!
    2011-06-23 18:04:59.875 NOTICE [PID:13711] Server Stopped!
    2011-06-23 18:05:00.105 NOTICE [AutoUpdate] Checking for new releases..., pid=7412
    2011-06-23 18:05:00.115 NOTICE Start to clean up cache directory, pid=7413
    2011-06-23 18:05:00.211 INFO [AutoUpdate] No new update.
    2011-06-23 18:05:00.310 INFO [HTAccess] Updating configuration from [/home/gttnut/public_html/.htaccess]
    2011-06-23 18:05:01.076 INFO [127.0.0.1:47606-0#APVH_*_sv1.gttalk.com] File not found [/usr/local/apache/htdocs/whm-server-status]
    2011-06-23 18:05:01.078 INFO [LICENSE] License is OK.
    2011-06-23 18:05:01.091 INFO [127.0.0.1:47607-0#APVH_*_sv1.gttalk.com] File not found [/usr/local/apache/htdocs/server-status]
    2011-06-23 18:05:11.808 INFO [HTAccess] Updating configuration from [/home/gttalk/public_html/.htaccess]
    2011-06-23 18:06:15.361 INFO [HTAccess] Updating configuration from [/home/opt/public_html/.htaccess]
  4. NUTNDUN

    NUTNDUN New Member

    Here are my current configuration settings also:

    General:
    ----------------------------------------------
    Server Name $HOSTNAME
    Running As user(nobody) : group(nobody)
    Priority -19
    chroot Path /
    Enable chroot No
    Enable LVE Not Set
    Memory I/O Buffer 60M
    Swapping Directory /tmp/lshttpd/swap
    Auto Restart Yes
    Auto Fix 503 Error Yes
    Graceful Restart Timeout (secs) Not Set
    MIME Settings $SERVER_ROOT/conf/mime.properties
    Disable Initial Log Rotation Yes
    Server Signature Hide Version
    Enable IP GeoLocation Not Set
    Use Client IP in Header Not Set
    Check For Update Daily
    Download Updates Yes
    Administrator Email root@localhost
    Index Files index.html, index.php, index.php5, index.htm
    Auto Index No
    Auto Index URI Not Set
    HT Access Edit
    Allow Override Limit Auth FileInfo Indexes Options None
    Access File Name .htaccess
    Enable Expires Yes
    Expires Default Not Set
    Expires By Type image/*=A604800, text/css=A604800, application/x-javascript=A604800, application/javascript=A604800
    IP to GeoLocation DB Add DB File Path DB Cache Type Action
    Load Apache Configuration Yes
    Auto Reload On Changes Use Apache binary wrapper
    Apache Binary Path /usr/local/apache/bin/httpd
    Apache Configuration File /usr/local/apache/conf/httpd.conf
    Apache Port Offset 0
    Apache IP Offset 0
    Apache Handled Content Not Set
    Ignore Apache Modules Not Set
    PHP suEXEC No
    PHP suEXEC Max Conn 10
    Enable FrontPage Extension No
    Apache Style Configurations Edit
    Apache Style configurations Not Set



    Here are a LSPHP5 settings:
    -------------------------------------------
    Name lsphp5
    Address uds://tmp/lshttpd/lsphp5.sock
    Notes Not Set
    Max Connections 50
    Environment PHP_LSAPI_MAX_REQUESTS=500
    PHP_LSAPI_CHILDREN=50
    Initial Request Timeout (secs) 60
    Retry Timeout (secs) 0
    Persistent Connection Yes
    Connection Keepalive Timeout -1
    Response Buffering No
    Auto Start Yes
    Command $SERVER_ROOT/fcgi-bin/lsphp5
    Back Log 100
    Instances 1
    suEXEC User Not Set
    suEXEC Group Not Set
    Run On Start Up Not Set
    Max Idle Time -1
    Priority 0
    Memory Soft Limit (bytes) 450M
    Memory Hard Limit (bytes) 500M
    Process Soft Limit 200
    Process Hard Limit 200
  5. NiteWave

    NiteWave Administrator

    does it happen often?
  6. NUTNDUN

    NUTNDUN New Member

    Seems to be averaging about once an hour or so, it isn't consistent either, like one time it might be 45 minutes and then the next time it might be an hour and 15 minutes. So far the highest hits I have been able to get on xcache has been 195,000 and that lasted about an hour and fifteen minutes.

    We do have configserver plugin installed on this one but we also had it on our last vps. Clam AV is also on it and we didn't have it on the other server.
  7. NiteWave

    NiteWave Administrator

    so the issue is: lsws restarts about once 1 hour in unknown reason, and that can explain the cache reset issue. true?
  8. NUTNDUN

    NUTNDUN New Member

    Yes that seems to be the issue.
  9. webizen

    webizen New Member

    Did you get email from cPanel when LSWS was restarted?

  10. NUTNDUN

    NUTNDUN New Member

    No, I am not getting any emails about LSWS being restarted. I get emails if I goof up trying to login the the LSWS admin panel though.
  11. cmanns

    cmanns New Member

    I'm running 4.1.1 and it exists every hour or so too without reason.


    Anyways guy try this

    We got child procs to 4 (half of cpu's, we have muti-client using php so we dont want them overtaking all cpus by 1 proc on accident randomly)

    max req per proc on php is 2500, 5000 caused one proc to do 90% cpu roughly on some clock strace I thought I posted the error here but seems I forgot (was tired, sorry nitewave

    2000/2500 seems nice. XCache caches decent, php process idle time is 120 seconds so it's hopefully one of the 4 possibly spawned per 20 or so vhosts is active. Ram seems okay barely swap on a 10gb system with high mem tuned mysql with 16gb of db's
  12. priestjim

    priestjim New Member

    I've been experiencing cache clearing as well. I have configured Litespeed to let PHP/LSAPI to self-manage its instances:

    Instances: 1
    Suexec: on
    Max connections: 64
    PHP_LSAPI_CHILDREN=64
    LSAPI_CHILDREN=64

    From my experience with PHP-FPM (where opcode caches work perfectly) the process tree in litespeed should work as:
    - lshttpd
    -- lsphp5 process manager
    --- lsphp5 (as user example1 - child process)
    --- lsphp5 (as user example1 - child process)
    --- lsphp5 (as user example2 - child process)
    --- lsphp5 (as user example2 - child process)

    where the lsphp5 process manager spawns lsphp5 processes running as suexec user example1 and example2 depending on the requests served and each one of them can read/write the process manager's shared memory segment that caches both example1 and example2 user files.

    What I get on Litespeed is no lsphp5 process manager and many example1 processed that each one of them run their own mmap cache segment which in turn constitutes any opcode cache useless.

    We *need* an operational opcode cache mechanism on Litespeed! Please fix it!
  13. NiteWave

    NiteWave Administrator

    since you set
    lsphp is not in self-manage mode.

    when php suExec enabled, only eAccelerator able to share opcode cache between processes, since the opcode cache is saved on disk.
  14. priestjim

    priestjim New Member

    This should be then a feature request then, since with suexec disabled PHP is pretty much useless in a shared environment.

    FYI, nginx + php-fpm operates EXACTLY as fastcgi + opcode cache should.
  15. mistwang

    mistwang LiteSpeed Staff

    that feature is on our to-do list. no ETA yet.
  16. prandah

    prandah Member

    hello, how to know
    xcache, apc, eacelarator is actif ?
    any advice ?
  17. webizen

    webizen New Member

    1. create a phpinfo page like

    then point browser to that file and see if you have these listed.

    or

    2. run command line

    if nothing comes up, then none of them is compiled in lsphp.
  18. prandah

    prandah Member

    hello thanks for reply :D

    Code:
    [root@poseidon ~]# /usr/local/lsws/fcgi-bin/lsphp5 -i | egrep -i 'apc|xcache|eaccelarator'
    Configure Command =>  './configure'  '--prefix=/usr/local/lsws/lsphp5' '--with-mysqli' '--with-gd' '--enable-shmop' '--enable-track-vars' '--enable-sockets' '--enable-sysvshm' '--enable-magic-quotes' '--enable-mbstring' '--with-iconv' '--with-litespeed' '--with-zlib' '--with-mysql' '--with-curl' '--with-config-file-path=/opt/lsws/php5' '--with-ioncube' '--with-pic' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-gettext' '--with-jpeg-dir=/usr' '--with-png' '--with-xcache' '--enable-xcache' '--with-php-config=/usr/local/lsws/lsphp5/bin/php-config' '--enable-suhosin'
    [root@poseidon ~]#
    
    what a command to compile it ?
  19. webizen

    webizen New Member

  20. prandah

    prandah Member

    hello thanks for your reply
    there is true ?

    PHP:
    [root@pegasus php]# /usr/local/lsws/fcgi-bin/lsphp5 -i | egrep -i 'apc|xcache|eaccelarator'
        
    with XCache v1.3.1Copyright (c2005-2010by mOo
    XCache
    XCache Support 
    => enabled
    xcache
    .admin.enable_auth => On => On
    xcache
    .cacher => On => On
    xcache
    .coredump_directory => no value => no value
    xcache
    .count => => 1
    xcache
    .gc_interval => => 0
    xcache
    .mmap_path => /dev/zero => /dev/zero
    xcache
    .readonly_protection => => 0
    xcache
    .shm_scheme => mmap => mmap
    xcache
    .size => => 0
    xcache
    .slots => 8K => 8K
    xcache
    .stat => On => On
    xcache
    .test => => 0
    xcache
    .ttl => => 0
    xcache
    .var_count => => 1
    xcache
    .var_gc_interval => 120 => 120
    xcache
    .var_maxttl => => 0
    xcache
    .var_size => => 0
    xcache
    .var_slots => 8K => 8K
    xcache
    .var_ttl => => 0
    [root@pegasus php]#

Share This Page