Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zumba Tech Blog:
Caching CakePHP 2.x routes
Oct 28, 2014 @ 15:47:02

On the Zumba Tech Blog today there's a new post with some helpful hints around caching routes in CakePHP 2.x to help optimize the requests and response time even further.

At Zumba we are continuously looking for optimization in our applications. These optimizations help to reduce the server loads, consequently reducing the number of servers and saving money. Besides that, it gives a better user experience for the end user by serving content faster and in some cases saving on consumer bandwidth (specially for mobile users). This week we profiled our app using Xdebug profiler and we identified the router was responsible for a big part of the request time. [...] In order to optimize the routing time, we started looking at options to optimize our routing process. After some research and deep checking in our codebase as well as CakePHP’s code, we found we could cache the routes easily.

Taking a cue from how FastRoute does their caching, their implementation uses a temporary file with the routes completely resolved and written out for easier handling. Since the routing is relatively static, this method works well and can be much faster than resolving them every time. They talk about some of the work done to optimize their method and some of the issues they came across during the process.

tagged: cakephp framework cache route file resolve

Link: http://tech.zumba.com/2014/10/26/cakephp-caching-routes/


Trending Topics: