Share » Forums » Install & configuration » Tip: Use APC filters to optimize...

Tip: Use APC filters to optimize cache usage

Tip: Use APC filters to optimize cache usage

Friday 26 November 2010 11:05:09 pm - 6 replies

Modified on Friday 26 November 2010 11:12:13 pm by Jani Tarvainen

Author Message

Bertrand Dunogier

Saturday 27 November 2010 8:32:30 am

Very good advice !

Cheap, efficient. There are other caches you might be interested in:

  • anonymous user info cache
  • translation cache
  • expiry cache
  • wildcard cache ?

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Nicolas Pastorino

Saturday 27 November 2010 1:21:06 pm

I agree excellent piece of advice !
Have you tried the before/after performance test after applying it ?

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Doug Brethower

Monday 29 November 2010 8:57:49 am

CentOS server with multiple virtual instances of eZ Publish running on one server.

Installed APC 3.0.19, got only 15 percent cache hits with default configuration and no apc.filters set.

Added to php.ini:

apc.filters = "-cache.*\.php"

This instantly boosted cache hits to 25 percent and noticeable speed improvement versus before APC install.

Surely more tweaking to be done, but very much thanks to Jani for the heads up!

Doug Brethower
Apple Certified Technical Consultant, Southwest, MO USA
http://share.ez.no/directory/companies/lakedata.net

Gaetano Giunta

Monday 29 November 2010 9:59:52 am

@Doug excellent idea, even though I'd normally go for putting as much stuff as you can in your APC cache.

But the best thing is: if you remove from the APC cache all the files generated by eZ, you can then simply

1. tell APC not to check the staleness of its cached files vs. timestamp of original pph files on the fs (apc.stat=0 in php.ini) and get a speed boost and IO pressure decrease on your fs (great if your install is eg. on NFS)

2. remember to clear APC cache by hand after every delivery of a new site update

Could you provide us with some numbers about page load times / reqs per sec. before and after the change?

One thing to note though: you might want to tune your templates, you might have cache-blocks that keep churning (use ggsysinfo to get a graph of the number of files-added-in-the-cache-per-minute on your install), as otherwise your apc cache hits should be much higher - f.e. the php files in the template cache should never expire, and be good candidates for APC caching.

Or you have just too little of shmem given to apc. What is your usage of it's allocated memory?

Going slightly OT: a lil' while ago I experimented with the best format to be ideally used for storing those caches that are basically data structures: plain php or json or serialized php.

The goals:

- try to use a format that is not cached by APC and friend by default, as it is basically memory wasting

- have the format that is both faster to load and using less memory for deserialization

It is to be noted that right now eZP uses all of those formats for different caches - picking a single format would also help in the overall goal of cleaning up cache management mechanics.

In the end my tests where not conclusive: depending on php/os version and presence or not of an accelerator the results changed.

But I'd be happy to pick them up again if anybody else is interested...

Principal Consultant International Business
Member of the Community Project Board

Carlos Revillo

Thursday 24 March 2011 10:15:17 am

2. remember to clear APC cache by hand after every delivery of a new site update

Hi Gaetano and all. Actually we're having some randomly perfomance problems in one of our developments. hosting company has pointed me to this topic.

about your reply, for 'new site update' i suppose you are talking about code updates right? (not content updates).

thanks in advance.

Gaetano Giunta

Thursday 26 May 2011 8:03:50 am

@Carlos: yes, I do talk of code updates, not content updates. The point is that you can do this iff php code generated as part of "content caches" is not stored in the apc cache...

Principal Consultant International Business
Member of the Community Project Board

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu