WordPress.org

Ready to get started?Download WordPress

Forums

WordPress W3 Total Cache and Alternative PHP Cache (APC) (7 posts)

  1. totalbarca
    Member
    Posted 2 years ago #

    My question is related to APC in particular but also pertains to WordPress and W3 Total Cache plugin. I am working on a site powered using WordPress which has around 35,000 posts and 11,000 comments. It's running on a dedicated server. Till 2 days back, the condition of the site was really bad. It was taking around 30 to 60 seconds just to prepare/process the request (this doesn't include sending the actual content back to the user). You can imagine if it's taking that much time to just process the request, how much total time it must be taking.

    Anyways, in W3 Total Cache I had both database and object caching enabled. After doing some reading I found out it's better disabling database cache and just keeping object cache enabled. I did that and it helped but not enough.

    So I thought of getting APC installed so that I could store the object cache in APC instead of on disk. Now that APC is installed and I am trying to do that, the site just crashes. So I am wondering if APC needs tuning or proper configuring? Based on what I had read, the impression I got regarding APC was that it should work well out-of-the-box. Looks like that isn't the case? Or is APC just not designed for something like this? Should I try XCache or eAccelerator?

    Please advise what the issue can be. All help would be very much appreciated.

  2. Gilligan
    Member
    Posted 2 years ago #

    APC definitely needs tweaking. For a site the size of the one you describe, you will likely need to raise apc.shm_size to prevent cache fragmentation and errors.

    I have a blog post about tweaking APC for WordPress and W3 Total Cache, you might like to read it. My post is mostly concerned with getting APC to work with multiple virtual servers running fcgid, but there is quite a bit on APC performance tuning as well.

  3. Most likely APC is conflicting with something. Do you have Zend Optimizer installed? If so that will cause your server to throw a 500 error when you try to load a page.

  4. totalbarca
    Member
    Posted 2 years ago #

    @c3mdigital: APC is still running, it's just not being used by the W3TC plugin at the moment and no, Zend Optimizer is not installed. Although it has ionCube running.

  5. totalbarca
    Member
    Posted 2 years ago #

    More details I would like to add about the site:

    The site receives around 600,000 unique visitors per month and around 2 million page views per month.

    The details pertaining to the server are as follows:

    Processor: Core2Duo E7400 2x2.93GHz 3MB Cache

    RAM: 8 GB DDR2

    HDD: 500 GB

    I am trying to assess if whether the problem in hand is more server related than anything else and if so, what kind of server or server set up would be required at the very minimum?

    Thanks for all the replies so far!

  6. Gilligan
    Member
    Posted 2 years ago #

    That's a load of traffic, but 8GB ram should, in theory, handle it. However, this requires optimizing Apache and MySQL. The server must provide a sustainable number of user sessions without going into swap memory or disk storage of common queries, tables, etc. It must also quickly provide new connections and recycle idle connections.

    If the server "crashes" and cannot allocate memory, Apache and MySQL are likely not optimized.

    Here is good advice on tweaking Apache performance to provide a sane number of connections.

    For reference, here is an Apache configuration that works well on a 6GB RAM VPS:

    httpd.conf settings

    TimeOut 300
    KeepAlive on
    MaxKeepAliveRequests 500
    KeepAliveTimeout 10
    <IfModule prefork.c>
    StartServers           25
    MinSpareServers        25
    MaxSpareServers       100
    ServerLimit           384
    MaxClients            256
    MaxRequestsPerChild 10000
    </IfModule>

    MySQL cache is somewhat difficult to tweak. A properly configured MySQL cache can provide a foundation to help W3TC and APC function. Use the MySQLTuner perl script to test the effectiveness of MySQL setup & provide guidance.

    For reference, here are MySQL settings that work well on a 6GB RAM VPS server:

    my.cnf settings

    [mysqld]
    set-variable = net_buffer_length=8M
    set-variable = max_allowed_packet=2M
    set-variable = myisam_sort_buffer_size=72M
    set-variable = sort_buffer=8M
    set-variable = key_buffer=72M
    set-variable = table_cache=3333
    set-variable = query_cache_size=256M
    set-variable = thread_cache_size=8
    set-variable = innodb_buffer_pool_size=28M
    set-variable = join_buffer_size=12M
    set-variable = tmp_table_size=32M
    set-variable = max_heap_table_size=28M
    set-variable = max_connections=200
    set-variable = wait_timeout=10
    set-variable = max_connect_errors=100

    ALSO: use stateful iptables firewall & intrusion detection software to lessen wasted resources consumed by bad bots, DOS attacks, or over allocation of connections to crawlers/spiders/bots. Configserver Firewall or OSSEC works well.

  7. Frederick Townes
    Member
    Posted 2 years ago #

    The opcode cache you choose is not the issue. I think the keep alive setting being on without using a reverse proxy is part of the problem. eAccelerator doesn't suport user caching of files so it cannot work with your object cache. I would be curious to learn what the errors are in the error log when things crash.

Topic Closed

This topic has been closed to new replies.

About this Topic