When do you not want to use memcached in a Ruby on Rails application?

Assuming a MySQL data warehouse, when you don't want to use memcached in a Ruby on Rails application?

+4
source share
4 answers

Memcache is a powerful distributed cache, but it is no faster than caching locally for some content. Caching should allow you to avoid bottlenecks, which are usually database queries and network queries. If you can cache your full page locally as HTML because it does not change very often (not very dynamic), your web server can serve it much faster than the memcache request. This is especially true if your memcache server, like most memcached servers, is on separate machines.

The flip side of this is that I sometimes use memcache locally, rather than other caching options, because I know that someday I will need to move it to my own server.

+6
source

Do not use memcached if your application can quickly process all requests. Adding memcached is an extra mental overhead when it comes to coding your application, so don't do this if you don't need it.

Scaling is one problem with the spell .

+10
source

The main advantage of memcached is that it is a distributed cache. This means that you can generate once and maintain the cache on many servers (this is why memcached was created). All the previous answers seem to ignore this - it makes me wonder if they ever need to create a highly scalable application (for what memcached is)

Danga Interactive developed memcached to increase the speed of LiveJournal.com, a site that was already making 20 million + dynamic page views per day for 1 million users with a group of web servers and a bunch of database servers . memcached dropped database loading for almost nothing, providing faster page load time for users, more efficient use of resources, and faster access to databases on memcache slip.

(My brave)

So the answer is: if your application will only ever be deployed on a single server.

If you ever use more than one server (for scalability and redundancy), memcached is (almost) always a good idea.

+4
source

If you want to have small-scale expiration controls. Of my tests, memcached seems to have a temporary resolution of about a second.

EG: if you say something will expire in 1 second, it can remain about 1 and a little more than 2 seconds.

0
source

Source: https://habr.com/ru/post/1277327/


All Articles