Home >Database >Redis >How does redis work?

How does redis work?

silencement
silencementOriginal
2019-06-05 14:37:344776browse

How does redis work?

The working principle of redis

Redis is a key-value storage system. Similar to Memcached, it supports relatively more stored value types. Including string (string), list (linked list), set (set), zset (sorted set - ordered set) and hashs (hash type)

These data types all support push/pop and add /remove and take intersection union and difference set and richer operations, and these operations are atomic.

On this basis, redis supports various ways of sorting. Like memcached, in order To ensure efficiency, data is cached in memory.

The difference is that redis will periodically write updated data to disk or write modification operations to additional record files, and on this basis, it is implemented master-slave (master-slave) synchronization.

Advantages of Redis:

Extremely high performance – Redis can support a read and write frequency of more than 100K per second.

Rich data types – Redis supports Strings, Lists, Hashes, Sets and Ordered Sets data type operations for binary cases.

Atomic - All operations of Redis are atomic, and Redis also supports atomic execution of several operations after they are fully merged.

Rich features – Redis also supports publish/subscribe, notifications, key expiration and other features.

The following is the official benchmark-mark data:

The test completed 50 concurrent executions of 100,000 requests.

The value set and obtained is a 256-byte string.

The Linux box is running Linux 2.6, which is X3320 Xeon 2.5 ghz.

Text execution uses the loopback interface (127.0.0.1).

Result: The writing speed is 110,000 times/s, and the reading speed is 81,000 times/s.

The above is the detailed content of How does redis work?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn