Hi, i would like to share my current experience with caching.
We currently launched a rewrite of our discussion forum with approx 10 thousand visits daily, used Phalcon 1.2.4. The site is stable, but in comparation with previous results (measured by NewRelic monitoring agent), we saw massive increase in web transaction time (server processing - php + db + memcached + external services). php stayed low, db as well (both together under 200ms), but memcached increased drastically up to 2000ms for each transaction. CPU load (machine has 2xCPU 2620, 24 mT cores alltogether, used to run under 1.00 load) went up massively to values around 7.00-8.00
I wondered why :)
Tried to change memcache setup, size, free it, etc, no help, still saw massive memcache usage and the monitoring page showed that WRITE to memcache went to MegaBytes per second, while READ was low (60kb/s). Amount of requests was low as well, not more than 70/s. What the heck !
When reading about possible caching mechanism, maybe to replace memcache with redis, mongo or any other "new magic" (dont get me wrong, im oldschool php programmer :D ), i realised one small note in caching using
Phalcon\Cache\Frontend\Data
The values are being SERIALISED. Well, gotcha ! Im storing arrays, sometimes huge arrays of values, sometimes parts of html code and so on. Serialization in php never worked really fast. Changed my code to
Phalcon\Cache\Frontend\None
restarted app, restarted memcache to get rid of old serialised data, and voila :
The measured memcached delay went down from 2000ms to non measurable 58ms ... CPU load went down to 1.50 average ... Site reports time to first byte down from 1.5 second to 0.6 second, which I consider to be normal for my site. Memcache reporting shows reads and writes in similiar numbers, around 100kb/s. Cool.
So in case you are having slow caching mechanism, please check, if your data are being serialised, and if they are needed to be serialised, or not.