eAccelerator slows my website down?

Author Message

Clemens T

Tuesday 01 September 2009 11:12:50 am

Heya all,

Installing eAccelerator had quite the opposite effect than I expected, it slowed my website down quite a bit. Loading a page without eAccelerator takes ~0.7 seconds.

Checkpoint	Elapsed	Rel. Elapsed	Memory	Rel. Memory
Module start 'content'	0.0000 sec	0.1582 sec	7,254.5469KB	2,069.6875KB
Module end 'content'	0.1582 sec	0.0894 sec	9,324.2344KB	387.0547KB
End	0.2476 sec	 	9,711.2891KB	0.3780KB
Total runtime:	0.3197 sec	
 Accumulator	 Elapsed	 Percent	 Count	 Average
ini_load				
Load cache	0.0328 sec	4.8918%	10	0.0033 sec
Mysql Total				
Mysql_queries	0.0091 sec	1.3653%	2	0.0046 sec
Looping result	0.0001 sec	0.0187%	2	0.0001 sec
Template Total	0.1423 sec	21.2%	2	0.0711 sec
Template load	0.0585 sec	8.7298%	2	0.0292 sec
Template processing	0.0810 sec	12.1000%	2	0.0405 sec
override				
Cache load	0.0278 sec	4.1561%	2	0.0139 sec
General				
dbfile	0.0052 sec	0.7748%	9	0.0006 sec
Total script time:	0.6697 sec	

Loading the same page with eAccelerator enabled takes much more time:

Checkpoint	Elapsed	Rel. Elapsed	Memory	Rel. Memory
Module start 'content'	0.0000 sec	1.1264 sec	6,299.7656KB	1,775.0234KB
Module end 'content'	1.1264 sec	0.2698 sec	8,074.7891KB	367.8281KB
End	1.3962 sec	 	8,442.6172KB	0.3592KB
Total runtime:	1.9067 sec	
 Accumulator	 Elapsed	 Percent	 Count	 Average
ini_load				
Load cache	0.2631 sec	6.9596%	10	0.0263 sec
Mysql Total				
Mysql_queries	0.0284 sec	0.7516%	2	0.0142 sec
Looping result	0.0001 sec	0.0029%	2	0.0001 sec
Template Total	0.6867 sec	18.2%	2	0.3434 sec
Template load	0.1810 sec	4.7888%	2	0.0905 sec
Template processing	0.5040 sec	13.3324%	2	0.2520 sec
override				
Cache load	0.1369 sec	3.6212%	2	0.0684 sec
General				
dbfile	0.0239 sec	0.6318%	9	0.0027 sec
Total script time:	3.7803 sec	

Nothing else changed.

Some caching settings that were enabled also:

TemplateCompile=enabled
TemplateOptimization=enabled
TemplateCache=enabled
ViewCache=Enabled
.... etc.

Here's what I got from phpInfo (I'm in a shared environment):

eAccelerator support	enabled
Version 	0.9.5.3
Caching Enabled 	true
Optimizer Enabled 	true
Memory Size 	33,554,396 Bytes
Memory Available 	1,660 Bytes
Memory Allocated 	33,552,736 Bytes
Cached Scripts 	564
Removed Scripts 	0
Cached Keys 	0

Directive	Local Value	Master Value
eaccelerator.allowed_admin_path	/usr/share/eaccelerator/scripts	/usr/share/eaccelerator/scripts
eaccelerator.cache_dir	/var/cache/eaccelerator	/var/cache/eaccelerator
eaccelerator.check_mtime	1	1
eaccelerator.compress	1	1
eaccelerator.compress_level	9	9
eaccelerator.content	shm_and_disk	shm_and_disk
eaccelerator.debug	0	0
eaccelerator.enable	1	1
eaccelerator.filter	no value	no value
eaccelerator.keys	shm_and_disk	shm_and_disk
eaccelerator.log_file	/var/log/httpd/eaccelerator_log	/var/log/httpd/eaccelerator_log
eaccelerator.name_space	no value	no value
eaccelerator.optimizer	1	1
eaccelerator.sessions	shm_and_disk	shm_and_disk
eaccelerator.shm_max	0	0
eaccelerator.shm_only	0	0
eaccelerator.shm_prune_period	0	0
eaccelerator.shm_size	0	0
eaccelerator.shm_ttl	0	0

What settings are blocking the speedup an accelerator is promising to happend?

Thanks a lot in advance!

Björn Dieding@xrow.de

Tuesday 01 September 2009 2:45:41 pm

from my memory

eaccelerator.shm_only 1

and "maybe" disable

eaccelerator.content
eaccelerator.sessions

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Clemens T

Wednesday 02 September 2009 5:10:51 am

Björn,

Thanks for your response. Can you offer me extra background information as to why this setting will work (shm_only)? On a lot of other configurations here on this site people don't have that enabled, where they still get great speed. I'm not sure that's it, and unfortunately I cannot 'just' try it for a second since I'm on a shared platform.

Thanks!!

Clemens T

Wednesday 02 September 2009 5:21:27 am

for example here:
http://www.frefred.fr/blog/linux/installer-eaccelerator-pour-ez-publish

it gives these settings:

extension=eaccelerator.so
eaccelerator.shm_size="48"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="0"

I think the most important different from mine there is that compression is turned off and the memory is more than in my configuration. Are these settings any better?

Björn, I also saw your earlier post (@: http://ez.no/developer/forum/install_configuration/eaccelerator_benchmark ) regarding eAccelerator. Did you manage to fix that issue?

Your configuration while underperforming was:

eaccelerator.cache_dir = /var/cache/php-eaccelerator
eaccelerator.shm_size = 0
eaccelerator.enable = 1
eaccelerator.optimizer = 1
eaccelerator.check_mtime = 1
eaccelerator.filter = "*.php *.phtml !.cache"
eaccelerator.shm_max = 0
eaccelerator.shm_ttl = 3600
eaccelerator.shm_prune_period = 0
eaccelerator.shm_only = 1
eaccelerator.compress = 1
eaccelerator.compress_level = 9
eaccelerator.debug = 0
eaccelerator.keys = "shm_only"
eaccelerator.sessions = "shm_only"
eaccelerator.content = "shm_only"

with a lot of shm_only in it. Is that still required? How about that filter, is that at 'must'?

What are recommended settings for ezpublish?

Regards & thanks again!
Clemens

Gaetano Giunta

Wednesday 02 September 2009 7:49:02 am

By your data:

Memory Size     33,554,396 Bytes
Memory Available        1,660 Bytes
Memory Allocated        33,552,736 Bytes

It means that eA is currently using (almost) all of the shmem it can use.
Once it goes over that limit, it will start swapping cached files out of it to make room for new ones when they are needed (or not cache new ones at all - there might be a setting to control how cache pruning is done).

Try raising that value to 48 or 64 MB and see if things get better...

[EDIT]

Otoh if you already have it set to 0 it might mean that eA will allocate dynamically as much as needed, so the above suggestion might not apply.

Not enabling compression makes sense, as compressing/decompressing the cached scripts will of course take some time.

Relying only on shmem and not disk is also a good idea, as it is probable that eA currently stores the cached files on disk too - which adds a lot of IO to the disk, probably very much stressed already by eZ.

Last but not least, the filter - it should not be necessary. But your best option is to look in the eA control panel and look at the list of cached files to see what is in there...

Principal Consultant International Business
Member of the Community Project Board

Clemens T

Wednesday 02 September 2009 8:02:45 am

Hey Gaetano,

Thank you for the time you took to write the reply.

Since the memory is still not full I believe it is not the solution, the usage doesn't increase anymore either.

I will try to ask if they can enable shm_only and disable compression. Disabling compression will probably require a higher amount of memory, so I will ask for a 48MB limit.

Unfortunately I don't have admin rights to get into the admin interface of eAccelerator, I can only ask for config changes and cannot see which files are being cached etc.

I'm using ez Publish 3.9.5, and it looks as though a lot of files in de /var directory are still .php (for example: compile templates / compiled .ini). They probably have to be excluded from acceleration, or am I making a mistake here? Can I use a filter to do that?

Regards & thanks again,
Clemens

Gaetano Giunta

Wednesday 02 September 2009 10:05:15 am

Do the compiled ini and template files have to be excluded from caching?

That's a good question.

In principle, after being cached, most of those will be run many times, so caching them with an opcode cache should benefit anyway.

If they are used only once or regenerated too often, then the problem lies in your eZP cache config and you should try to fix that instead.

Some of those are basically definitions of a single php array, so the net speed gain is probably not much for those (eg. compiled ini files or translations)

All of the files that contain html chunks (template-block/*) should not be cached by eA anyway.

About not being admin: the control.php file that comes with eA does pwd checking, it's not a function of the eA api; So you can just grab a copy of it, remove the password checking, and copy it in the server and voilà, istant eA info - or you can install the ggsysinfo extension...

Principal Consultant International Business
Member of the Community Project Board

Clemens T

Wednesday 02 September 2009 11:53:38 am

Hey Gaetano,

Thanks again. I speed up the loading of the ini files by using the 'hack' I found on this site ( http://www.seeds.no/eng/ez-publish/ez-publish-tips-and-tricks/speeding-up-ez-publish-by-fixing-ini-cache/ini-cache-patch ), so they are not regenerated everytime. This doesn't work in combination with eAccelerator. I did turn off the eA for that part via .htaccess:

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0

All the other settings are OK. eZPublish cache and templates are well configured so I don't have to regenerate a lot of files every other second, next to that the stuff in the template dir are .cache files, so they're probably ok too.

The hint on the controlpanel was a smart one, and it does work I get some extra info, but the list of cached files is not there. It table is empty, or I don't have the right to read any of that info at this time? Next to that I can also not purge/clear/clean caches I believe. Any thoughts on that?

Regards,
Clemens

Clemens T

Thursday 03 September 2009 5:24:28 am

OK turns out, the INI -hack doesn't work with eAccelerator. Everything has been re-set, and the following settings make my site blazing fast (0.2-0.4s per page... ):

Directive	Local Value	Master Value
eaccelerator.cache_dir	/var/cache/eaccelerator	/var/cache/eaccelerator
eaccelerator.check_mtime	1	1
eaccelerator.compress	0	0
eaccelerator.compress_level	9	9
eaccelerator.content	shm_only	shm_only
eaccelerator.debug	0	0
eaccelerator.enable	1	0
eaccelerator.filter	no value	no value
eaccelerator.keys	shm_only	shm_only
eaccelerator.log_file	/var/log/httpd/eaccelerator_log	/var/log/httpd/eaccelerator_log
eaccelerator.name_space	no value	no value
eaccelerator.optimizer	1	1
eaccelerator.sessions	shm_only	shm_only
eaccelerator.shm_max	0	0
eaccelerator.shm_only	1	1
eaccelerator.shm_prune_period	3600	3600
eaccelerator.shm_size	0	0
eaccelerator.shm_ttl	0	0

Regards & thanks to all,
Clemens

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.