Home  >  Article  >  Database  >  What is redis used for?

What is redis used for?

silencement
silencementOriginal
2019-06-06 14:10:116903browse

What is redis used for?

First understand what redis is

Redis is a memory developed by Italian Salvatore Sanfilippo (screen name: antirez) Cache database. 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.

Characteristics 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. (redis tutorial)

Redis application scenarios, what it can do

Many languages ​​support Redis because Redis exchange Data is fast, so it is often used in servers to store some data that needs to be retrieved frequently. This can greatly save the I/O overhead of the system directly reading the disk to obtain data, and more importantly, it can greatly improve 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.

The above is the detailed content of What is redis used for?. 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
Previous article:What is redis persistenceNext article:What is redis persistence