Home  >  Article  >  Database  >  Why redis is needed

Why redis is needed

(*-*)浩
(*-*)浩Original
2019-11-22 09:27:363098browse

Why redis is needed

Redis is completely open source and free, complies with the BSD protocol, and is a high-performance key-value database. It is one of the most popular NoSql databases at present, and is also called a data structure server.

So why use Redis? The reason is simple, hurry up! (Recommended Learning: Redis Video Tutorial )

This problem is large concurrency, and all data in the .Rdis database must be stored in the memory. middle. Since the read and write speed of memory is much faster than that of hard disk, Redis has very obvious advantages in performance compared with other databases based on hard disk storage.

The use of Redis in the project is mainly considered from two perspectives: performance: concurrency. Of course, Redis also has other functions such as distributed locks, but if it is just for other functions such as distributed locks, there are other middleware instead, and you do not have to use Redis.

Therefore, this question is mainly answered from two perspectives: performance and concurrency.

Performance:

When we encounter SQL that takes a particularly long time to execute and the results do not change frequently, it is particularly suitable to put the running results into the cache, so , subsequent requests are read from the cache, and the requests can be responded to quickly.

Why redis is needed

Concurrency:

In the case of large concurrency, all requests directly access the database, and a connection exception will occur in the database. At this time, you need to use Redis to perform a buffering operation so that the request can access Redis first instead of directly accessing the database.

Why redis is needed

Advantages of redis:

1, running in memory, fast speed, the official claims to support concurrent 11 watt read operations , with 8 watts of concurrent close-up operations, it can be said to be quite powerful.

2. Although the data is in the memory, it provides persistence support, that is, the data in the memory can be written asynchronously to the hard disk without affecting the continued provision of services.

3, Support Rich data structures (string (string), list (linked list), set (set), zset (sorted set - ordered set)) and Hash (hash type, the string encrypted by md5)

For more Redis-related technical articles, please visit the Introductory Tutorial on Using Redis Database column to learn!

The above is the detailed content of Why redis is needed. 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:Why is redis so fast?Next article:Why is redis so fast?