Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the advantages and disadvantages of memcached and redis?

Shulou Source: shulou.com Published: 2022-06-01 19:02:33 09月18日 Update

1. What are the benefits of using redis?

(1) it is fast, because the data is stored in memory, and the advantage similar to HashMap,HashMap is that the time complexity of search and operation is O (1).

(2) supports rich data types and string,list,set,sorted set,hash

(3) transactions are supported, and all operations are atomic. the so-called atomicity means that changes to the data are either performed or not performed at all.

(4) rich features: can be used for caching, messages, set expiration time by key, and will be deleted automatically after expiration

2. What are the advantages of redis over memcached?

(1) all values of memcached are simple strings, and redis, as its replacement, supports richer data types.

(2) redis is much faster than memcached.

(3) redis can persist its data

3. Common performance problems and solutions of redis:

(1) Master is best not to do any persistence work, such as RDB memory snapshots and AOF log files.

(2) if the data is important, a Slave enables AOF to back up data, and the policy is set to synchronize once per second.

(3) for the speed of master-slave replication and the stability of connection, Master and Slave should be in the same local area network.

(4) try to avoid adding slave libraries to the stressed master libraries.

(5) Master-slave replication does not use graphic structure, but one-way linked list structure is more stable, that is, Master

Tags: Data memory support user cache that is speed snapshot file time type performance best structure problem subscription master-slave function backup size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Microsoft NVidia Xiaomi Redmi