paan
paan

Reputation: 7182

Opcode cache impact on memory usage

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 increase. I have a small entry level VPS and memory limits are a concern for me.

Upvotes: 1

Views: 762

Answers (3)

AdamTheHutt
AdamTheHutt

Reputation: 8617

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.

Upvotes: 0

BlaM
BlaM

Reputation: 28858

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 ;)

Upvotes: 0

Edmund Tay
Edmund Tay

Reputation: 1257

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.

Upvotes: 5

Related Questions