Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use memcached

Tags:

php

memcached

I`m planing to use memcached in one of my websites. Here is from memcached home page

Memcached is an in-memory key-value store for small chunks of arbitrary data

I consider to use memcached in search/result page where every query returns about 4kb (text).

In this case is it reasonable to use memcached ?

like image 468
omtr Avatar asked Jan 20 '11 18:01

omtr


People also ask

Why do we use Memcached?

Memcached can serve cached items in less than a millisecond, and enables you to easily and cost effectively scale for higher loads. Memcached is popular for database query results caching, session caching, web page caching, API caching, and caching of objects such as images, files, and metadata.

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?

When storing data, Redis stores data as specific data types, whereas Memcached only stores data as strings. Because of this, Redis can change data in place without having to re-upload the entire data value. This reduces network overhead.


1 Answers

Yes, absolutely.

I current use Memcache on a number of sites and regulary stores blobs of 50kb and more. Personally I would say that anything below 500kb would be fine, however I would recommend that you have a look through the memcache docs for specifics.

EDIT

Just checked one of my busier servers, the largest blob I have in memcache is 77.2kb and all is running fine.

like image 147
MrEyes Avatar answered Oct 12 '22 06:10

MrEyes