views:

187

answers:

4

Can anyone tell me what is the memory usage overhead associated with PHP opcode cache?
I've seen a lot of reviews of opcode cache but all of them only concentrate on the performance increace. I have a small entry level VPS and memory limits are a concern for me.

+3  A: 

Most of the memory overhead will come from the opcode cache size. Each opcode cacher has their own default(e.g. 30MB for APC) which you can change through the config file.

Other than the cache size, the actual memory overhead of the cacher itself is negligible.

Edmund Tay
A: 

@Edmund (#29570)
Other than the cache themselves, is there other overhead? is it safe to assume that it is negligible?

paan
A: 

In todays world: It's neglectible. I think memory consumption was about 50 MB bigger with eAccelerator then it was without when I did my benchmarks.

If you really need the speed but do have headaches that your RAM might be not enough: grab $40 and buy another GIG of RAM for your server ;)

BlaM
A: 

You can set a limit to memory consumption for APC, but that potentially limits its effectiveness. If you're just using it for silent opcode caching, then it should be fine. Once the memory allotment is full, no new files will be cached, but everything will work as expected. However, the user-space cache functions like apc_store() and apc_fetch() will fail silently and inexplicably if there is no memory available. This can be tricky to catch and debug since no error is reported and no exception is thrown.

AdamTheHutt