eaccelerator and shared hosting environments

Support/Development for PHP
BruceLee
Forum Regular
Forum Regular
Posts: 879
Joined: Sat Mar 28, 2009 6:58 pm
Location: Germany

eaccelerator and shared hosting environments

Unread post by BruceLee »

Hi,

a project needs the eaccelerator_put function which is only available when eaccelerator is compiled with "--with-eaccelerator-shared-memory".
I have checked atomicorps Source RPM and it's not used.
Does anybody use it?
Scott, for which reason did you not include it?

The only facts that I found where
[quote]--with-eaccelerator-shared-memory
Include eaccelerator shared memory functions. The name is a bit confusing, but this will include the eaccelerator_get, _put, ... functions that allow scripts to store data in the eAccelelerator cache. This options has been enabled by default until version 0.9.5. When enabling this feature on systems where you can't trust all users, like in shared hosting environments, this could really fill up the cache causing all scripts to only exist on disk which isn't good for performance.[/quote]

SOURCE: [url]http://eaccelerator.net/wiki/CompileConfiguration#a--with-eaccelerator-shared-memory[/url]
Last edited by BruceLee on Sun Nov 21, 2010 11:35 am, edited 3 times in total.
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Re: eaccelerator and shared hosting environments

Unread post by scott »

As I recall Annoying and Bad Things(tm) happened last time we played around with it.
BruceLee
Forum Regular
Forum Regular
Posts: 879
Joined: Sat Mar 28, 2009 6:58 pm
Location: Germany

Re: eaccelerator and shared hosting environments

Unread post by BruceLee »

Thanks. If my system does not show e.g. segfaults and seems to run fine you would not recommend not using it, right?
It's just that you experienced problems. I could not find anything in the forum about this compile config.

Only that this one caused problems:
--with-eaccelerator-doc-comment-inclusion

Thanks
User avatar
mikeshinn
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 4149
Joined: Thu Feb 07, 2008 7:49 pm
Location: Chantilly, VA

Re: eaccelerator and shared hosting environments

Unread post by mikeshinn »

Its disabled because its got performance implications which are Bad In Practice(TM). If your users scripts dont clean up after themselves they will use up all the memory cache, forcing everything else to be written to the disk cache - which then means all those scripts will slow way down, I/O will go up, that will slow down your entire server, users will reload pages out of frustration, causing new I/O requests, which will stack up the queue - slowing things down further - wash, rinse, repeat. If they clean up after themselves, and play nice with others then you can sleep easy - unfortunately this is not always the case. (Tragedy of the commons)

So, I do not recommend you use this switch unless you know you can trust every script on your system to clean up after itself. Otherwise, consider this switch to be:

--I-feel-lucky!

That isn't to say it may not work for you, but keep in mind the system is at the mercy of your users applications to play nice. By default we build eaccelerator to clean up and keep things happy, enabling this switch will allow apps to stick things in the cache and nothing will clean up after them - ever. If they dont do it themselves, it wont happen.

So, if your cache fills up, you'll know why. If not, your current applications were written by people with clue, hopefully if anyone uploads anything else that will continue to be the lucky case for you. :-)
BruceLee
Forum Regular
Forum Regular
Posts: 879
Joined: Sat Mar 28, 2009 6:58 pm
Location: Germany

Re: eaccelerator and shared hosting environments

Unread post by BruceLee »

please see post below. Thanks
Last edited by BruceLee on Sun Nov 21, 2010 2:53 pm, edited 1 time in total.
BruceLee
Forum Regular
Forum Regular
Posts: 879
Joined: Sat Mar 28, 2009 6:58 pm
Location: Germany

Re: eaccelerator and shared hosting environments

Unread post by BruceLee »

Ok, thanks for thre quick reply and the infos.

EDIT:
Wouldn't those configuration options (set wisely) prevent this situation of "users scripts don't clean up after themselves they will use up all the memory cache"
------------------------------
eaccelerator.shm_size = "X"

This setting will allow you to control the amount of shared memory eAccelerator should allocate to cache PHP scripts. The number sets the amount of memory in megabytes. Setting this value to 0 will use the default size.
------------------------------
------------------------------
eaccelerator.shm_max = "X"

By default there is no limit on the maximum size a user can put in shared memory with functions like eaccelerator_put, the maximum size is controlled by this setting. This value is the maximum size that can be put in the cache, the size is given in bytes (10240, 10K, 1M). The default value is "0" which disables the limit.

This setting doesn't affect the maximum size for a script'''
------------------------------
------------------------------
eaccelerator.shm_ttl = "X"

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 = "X"

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.
------------------------------
------------------------------


So maybe I would need to setup another opcode caching engine for PHP.

APC (last stable: 2008-05-15)
or
XCache (last stable: 2009-08-04)

Both seem a little bit outdated though APC has at least betas that are still mantained.
Can they run beside eaccelerator? Are they really PHP 5.3.X ready (both show 5.3 support in the changelogs)?
And do they support mod_fcgid? I could not find any official infos about that.

Thanks for any infos.
Post Reply