Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

memcached, APCu or redis as cache for Symfony and Doctrine

We're currently trying to decide, what cache we should use with Symfony and Doctrine. The idea behind it, is to reduce load and db calls, by caching values. The caching systems in question are: memcached, APCu and redis.

Our current favorite would be APCu, as memcache probably will have a small overhead for it's capabillity to run as a distributed cache, however it would also allow to store PHP sessions directly in memcache. Redis seams "to much" as it can be used as a DB, so probably a lot of overhead, which leaves APCu.

The Symfony version currently used by us is 2.8, we will probably update it to 3.x in the near future, du to better integration of cache (for 3.1 and 3.3 we'll probably wait for the Symfony 3.3 release)

The advantage of memcached is clearly, that it is distributed, meaning multiple servers could access it. However we currently run the Symfony app on just one server and there's no plan yet to change this.

The question: What are the pros and cons of the three different caching systems? Specially, when using Symfony 2.8 vs. when using Symfony 3.x? What is the load, they will put on the System?

If the question is to opinion based, please feel free to close it.

like image 830
wawa Avatar asked May 05 '17 22:05

wawa


People also ask

Should I use Memcache or Redis?

Redis uses a single core and shows better performance than Memcached in storing small datasets when measured in terms of cores. Memcached implements a multi-threaded architecture by utilizing multiple cores. Therefore, for storing larger datasets, Memcached can perform better than Redis.

Why Redis is better than memcache?

Although they are both easy to use and offer high performance, there are important differences to consider when choosing an engine. Memcached is designed for simplicity while Redis offers a rich set of features that make it effective for a wide range of use cases.

What is cache in Symfony?

The Cache component provides features covering simple to advanced caching needs. It natively implements PSR-6 and the Cache Contracts for greatest interoperability. It is designed for performance and resiliency, ships with ready to use adapters for the most common caching backends.

What is doctrine cache?

Doctrine Cache is a library that provides an interface for caching data. It comes with implementations for some of the most popular caching data stores.


1 Answers

apcu and redis for data store (like doctrine metadata) there is a redis bundle that handles sessions and doctrine metadata https://github.com/snc/SncRedisBundle

like image 147
Omar Soufiane Avatar answered Sep 22 '22 19:09

Omar Soufiane