This article mainly introduces the definition, characteristics and uses of Redis in detail. Hope it helps friends in need!
1. What is Redis
Redis is an in-memory cache database developed by Italian Salvatore Sanfilippo (screen name: antirez). The full name of Redis is: Remote Dictionary Server (remote data service). The software is written in C language. Redis is a key-value storage system. It supports rich data types, such as: string, list, set, zset (sorted set), hash.
2. Features of Redis
Redis uses memory as the data storage medium, so the efficiency of reading and writing data is extremely high, far exceeding that of databases. Taking setting and getting a 256-byte string as an example, its reading speed can be as high as 110,000 times/s and its writing speed can be as high as 81,000 times/s.
The difference between Redis and memcache is that the data stored in Redis is persistent, and the data will not be lost after a power outage or restart. Because Redis's storage is divided into three parts: memory storage, disk storage and log files, after restarting, Redis can reload data from the disk into the memory. These can be configured through the configuration file. Because of this, Redis can achieve persistence. change.
Redis supports master-slave mode and can configure clusters, which is more conducive to supporting large-scale projects. This is also a highlight of Redis.
3. Redis application scenarios and what it can do
Many languages support Redis. Because Redis exchanges data quickly, it is often used in servers to store some data that needs to be retrieved frequently. In this way It can greatly save the I/O overhead of the system directly reading the disk to obtain data, and more importantly, it can greatly increase the speed.
Take a large website as an example. For example, the homepage of website A has 1 million visits a day, and there is a section for recommended news. If you query directly from the database, you will consume an additional 1 million database requests a day. As mentioned above, Redis supports a variety of data types, so this can be done entirely with Redis. This hotspot data is stored in Redis (memory). When needed, it can be retrieved directly from the memory, which greatly improves the speed. and save server overhead.
In short, Redis is very widely used and extremely valuable. It is really a powerful tool in the server, so from now on, we will learn it step by step.
For more Redis related knowledge, you can follow Redis Video Tutorial or Redis Manual.
The above is the detailed content of What are the defining characteristics and uses of Redis?. For more information, please follow other related articles on the PHP Chinese website!