Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have eAccelerator installed on a server running Wordpress using PHP/Apache on CentOS. I am occassionally getting persistent "white pages", which presumably are PHP Fatal Errors (although these errors don't appear in my error_log). These "white pages" are sprinkled here and there throughout the site. They persist until I go to my eAccelerator control.php page and clear/clean/purge my caches, which suggests to me that I've configured eAccelerator improperly.

Here are my current /etc/php.ini settings:

  • memory_limit = 128M;
  • eaccelerator.shm_size="64", where shm.size is "the amount of shared memory eAccelerator should allocate to cache PHP scripts" (see http://eaccelerator.net/wiki/Settings)
  • eaccelerator.shm_max="0", where shm_max is "the maximum size a user can put in shared memory with functions like eaccelerator_put ... The default value is "0" which disables the limit"
  • eaccelerator.shm_ttl="0" - "When eAccelerator doesn't have enough free shared memory to cache a new script it will remove all scripts from shared memory cache that haven't been accessed in at least shm_ttl seconds. By default this value is set to "0" which means that eAccelerator won't try to remove any old scripts from shared memory."
  • eaccelerator.shm_prune_period="0" - "When eAccelerator doesn't have enough free shared memory to cache a script it tries to remove old scripts if the previous try was made more then "shm_prune_period" seconds ago. Default value is "0" which means that eAccelerator won't try to remove any old script from shared memory."
  • eaccelerator.keys = "shm_only" - "These settings control the places eAccelerator may cache user content. ... 'shm_only' cache[s] data in shared memory"

On my phpinfo page, it says:

  • memory_limit 128M
  • Version 0.9.5.3 and Caching Enabled true

On my eAccelerator control.php page, it says

  • 64 MB of total RAM available
  • Memory usage 77.70% (49.73MB/ 64.00MB)
  • 27.6 MB is used by cached scripts in the PHP opcode cache (I added up the file sizes myself)
  • 22.1 MB is used by the cache keys, which is populated by the Wordpress object cache.

My questions are:

  • Is it true that there is only 36.4 MB of room in the eAccelerator cache for total "cache keys" (64 MB of total RAM minus whatever is taken by cached scripts, which is 27.6 MB at the moment)?
  • What happens if my app tries to write more than 22.1 MB of cache keys to the eAccelerator memory cache? Does this cause eAccelerator to go crazy, like I've seen?
  • If I change eaccelerator.shm_max to be equal to (say) 32 MB, would that avoid this problem?
  • Do I also need to change shm_ttl and shm_prune_period to make eAccelerator respect the MB limit set by shm_max?

Thanks! :-)

share|improve this question
add comment

1 Answer 1

I use almost identical eAccelerator settings and have never had any similar issue (I don't have any "keys" setting). As far as I am aware, fiddling with the settings will only change how effective, or not, the cache is. A "bad" eAccelerator setting should only result in scripts running slowly...not script errors.

I don't understand what you mean by "36.4 MB of room for cache keys". From your question eAccelerator is using 49.73 MB total with 27.6MB in scripts and 22.1MB in keys (27.6+22.1=49.7) leaving 14.3MB free.

With your current settings when the limit of 64MB allocated is reached eAccelerator simply won't cache anything anymore. There should be no issue caused by this other than some scripts not running as fast as they would be. If you want old cache entries to be deleted you can play with the various settings as mentioned. I usually just increase the amount of memory for eAccelerator such that it holds all scripts in memory.

If your scripts are showing "white pages" I would double check the error logs. If you don't get any error messages I would check that the error logs are enabled and working. I would try disabling eAccelerator and see if you can duplicate the script errors at all. If it seems to only happen with eAccelerator I would uninstall it and install from scratch.

Another remote possibility is bad memory or disk which is corrupting the cached versions.

share|improve this answer
    
Thanks! To clarify, I calculated 36.4 MB of total cached key "room" by starting with 64 MB and subtracting the 27.6 MB of cached scripts. It's also equal to 22.1 MB of keys + the free 14.3 MB you mentioned. –  bobbyh Feb 24 '11 at 22:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.