PHP APC: What happens when APC cache is full?

前端 未结 2 1414
难免孤独
难免孤独 2021-01-11 11:42

What happens when you try to add a variable into APC and the APC cache is full? Does it automatically remove least used variable from the cache?

2条回答
  •  感情败类
    2021-01-11 12:10

    From experience (we run it in production), if you do not set a TTL or the TTL is very very high and nothing is out of date, the entire cache is flushed (as in made empty). You really want to try and avoid this as it will cause a load spike on the next request that PHP has to deal with, becuase for every file needed APC will need to compile it and store it in memory (which as a slightly slower process than not having a cache enabled at all). Also if you are recieving lots of traffic and empty cache, you will experience cache slam (see google for the evilness of this)

    As a side note, see this old presentation for a fairly rough guide to APC and things to watch out for http://www.slideshare.net/oscon2007/os-gopal Somethings maybe out of date in it but the theory still holds true.

提交回复
热议问题