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

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

  1. TarkanVeKurdu

    TarkanVeKurdu New Member

    APC Cache shared memory mapping with SUPHP

    Hello,

    Is there any progress on this feature? We really need to have this feature while suphp enabled on the shared hosting environments.

    Regards
  2. webizen

    webizen New Member

    This is being tested and will be out soon.
  3. semprot

    semprot Member

    my apc is clearing out again even my litespeed is not restarted (i compared the apc uptime & litespeed uptime). apc uptime is about 6 mins, while the lsws uptime is about 30 mins now.

    It started to happen after my physical server restart. It was fine before.

    my memory usage is low.. about 12 percent.

    any idea what to check? :confused:
  4. webizen

    webizen New Member

  5. semprot

    semprot Member

    It is disabled and i use dedicated server.
    Litespeed uptime is very good (1 day+ -- since previous restart).
    But APC uptime is 36 mins or so.

    Any idea?

    Code:
    Runtime Settings
    apc.cache_by_default	1
    apc.canonicalize	1
    apc.coredump_unmap	0
    apc.enable_cli	1
    apc.enabled	1
    apc.file_md5	0
    apc.file_update_protection	2
    apc.filters	
    apc.gc_ttl	3600
    apc.include_once_override	0
    apc.lazy_classes	0
    apc.lazy_functions	0
    apc.max_file_size	20M
    apc.mmap_file_mask	/tmp/apc.nyEjzk
    apc.num_files_hint	1000
    apc.preload_path	
    apc.report_autofilter	0
    apc.rfc1867	0
    apc.rfc1867_freq	0
    apc.rfc1867_name	APC_UPLOAD_PROGRESS
    apc.rfc1867_prefix	upload_
    apc.rfc1867_ttl	3600
    apc.serializer	default
    apc.shm_segments	1
    apc.shm_size	1024M
    apc.slam_defense	1
    apc.stat	0
    apc.stat_ctime	0
    apc.ttl	0
    apc.use_request_time	1
    apc.user_entries_hint	4096
    apc.user_ttl	7200
    apc.write_lock	1
    Thanks.

    Addition : i got this tips on stackoverflow :
    "How many Litespeed processes do you have? I'm afraid that if you have more than 1 process, you'll have the same problem as with fastcgi/suphp, so you should try to recompile APC with --disable-apc-mmap".

    How to know how many litespeed process that i have? i use 2 cpu license.
    Code:
    root@mybox [~]# pstree -p | grep litespeed
            |-litespeed(19722)-+-httpd(19723)
            |                  |-litespeed(19724)-+-lsphp5(19730)-+-lsphp5(19734)
            |                  |                  |-{litespeed}(19726)
            |                  |                  `-{litespeed}(19728)
            |                  `-litespeed(19725)-+-lsphp5(19772)-+-lsphp5(19809)
            |                                     |-{litespeed}(19727)
            |                                     `-{litespeed}(19729)
    
    Last edited: Aug 24, 2012
  6. webizen

    webizen New Member

    for 2-cpu license, you have effectively two litespeed processes (1 parent pid 19722 and 2 active: pid 19724 and 19725 in your case).
  7. whatsup

    whatsup New Member

    Same problems here also

    Been reading different treads about this. Just upgraded to Litespeed 1 CPU version one month ago. I am now testing out Nginx also to see if I can get it to our server to work properly with APC.
  8. webizen

    webizen New Member

    Our lab test shows '--disable-apc-mmap' makes no difference.
  9. semprot

    semprot Member

    Somehow my issue was fixed, but it appears again now.

    The issue is still the same :
    - litespeed uptime is good, but
    - apc uptime is bad :(

    Any idea how to fix it?
  10. NiteWave

    NiteWave Administrator

    Code:
    - litespeed uptime is good, but
    - apc uptime is bad 
    
    if you refresh the apc stats page repeatly,
    check the apc.mmap_file_mask value, like /tmp/apc.nyEjzk,
    you should see 2 different files, corresponding 2 groups of lsphp5.
  11. semprot

    semprot Member

    I see no "apc.mmap_file_mask" on my stats page. I think because my APC was compiled with "--disable-apc-mmap".
    Should i recompile APC with mmap?
    (as far as i remember, when my APC had mmap, i only saw 1 apc.mmap_file_mask value on stats page)

    If not, what should i do?
  12. NiteWave

    NiteWave Administrator

    yes, please. we study the option -disable-apc-mmap in 2 ways:
    1.by reading the APC source code
    2.actual tests

    as we pointed out in previous thread: it not working at all.
    --enable-apc-mmap is enabled by default since APC 3.0.18.
    so it's a better method than --disable-apc-mmap which is default before 3.0.18

    please refresh repeatedly, it should have 2 values if you have 2 groups of lsphp5
    one group is lsphp5(19730), another one is lsphp5(19772)
  13. semprot

    semprot Member

    I have recompiled APC with mmap enabled.

    But i still see 1 value. Is it the cause of my problem?

    FYI i have LSAPI_AVOID_FORK=1 , i don't know whether it is related with 1 mmap or not.
    Code:
    root@mybox [~]# pstree -p | grep litespeed
            |-litespeed(24846)-+-httpd(24847)
            |                  |-litespeed(24848)-+-lsphp5(24856)-+-lsphp5(24857)
            |                  |                  |-{litespeed}(24850)
            |                  |                  `-{litespeed}(24851)
            |                  `-litespeed(24849)-+-lsphp5(24901)-+-lsphp5(24904)
            |                                     |-{litespeed}(24852)
            |                                     `-{litespeed}(24853)
    Code:
    apc.cache_by_default	1
    apc.canonicalize	1
    apc.coredump_unmap	0
    apc.enable_cli	1
    apc.enabled	1
    apc.file_md5	0
    apc.file_update_protection	2
    apc.filters	
    apc.gc_ttl	3600
    apc.include_once_override	0
    apc.lazy_classes	0
    apc.lazy_functions	0
    apc.max_file_size	20M
    apc.mmap_file_mask	/tmp/apc.3iYCNd
    apc.num_files_hint	1000
    apc.preload_path	
    apc.report_autofilter	0
    apc.rfc1867	0
    apc.rfc1867_freq	0
    apc.rfc1867_name	APC_UPLOAD_PROGRESS
    apc.rfc1867_prefix	upload_
    apc.rfc1867_ttl	3600
    apc.serializer	default
    apc.shm_segments	1
    apc.shm_size	1024M
    apc.slam_defense	1
    apc.stat	0
    apc.stat_ctime	0
    apc.ttl	0
    apc.use_request_time	1
    apc.user_entries_hint	4096
    apc.user_ttl	7200
    apc.write_lock	1
  14. NiteWave

    NiteWave Administrator

    should not be possible.

    maybe your site's traffic is idle ? if so, you can generate some traffic and test again. also, you can create a script to access apc.php for 100 or 1000 times, grep "Uptime" and "apc.mmap_file_mask" every time, should be able to see 2 values.

Share This Page