当前位置:网站首页>5 minutes to explain what is redis?
5 minutes to explain what is redis?
2022-06-23 22:17:00 【Network technology alliance station】
Definition
Redis It's fast 、 Open source 、 In memory Key value data structure storage .
REDIS Allows you to RAM Store key value pairs on , Because of the visit RAM Faster than accessing disk 150,000 times , Comparison visit SSD fast 500 times , That means speed .
however , We have used... In most operations RAM!
But when it comes to caching or database interaction , We use disk by default , Imagine accessing a database to read 10,000 Bar record , If the data is stored on disk , The average need is 30 second , And from RAM Reading takes approximately 0.0002 second .
That means it's an ultra fast read / Write system , But because it's stored in RAM in , So it's volatile .
that , Will we lose data ?
To prevent data loss , There is a built-in persistence module , It will write the memory state to the dump file on disk under given conditions , Dump files are loaded at system startup , Once it's up and running , Data can be used to operate , therefore , No data loss .
We can use different configurations in multiple instances , To allow us to maintain continuous uptime through the so-called sentinel and master-slave architecture .
Redis yes Remote Dictionary Server The acronym for .
let me put it another way , It's a tool , Let you in RAM Store database on .
When and where to use Redis?
because Redis Fast as lightning , Therefore, it is mainly used for caching purposes , It is Redis The most shining place , Because it provides various types that can be stored through dictionary structure .
We can use Redis Cache complete pages with high traffic and static content , If the page itself is easy to change or the content is generated dynamically , Then you shouldn't cache it anyway , Whether we use Redis still Memcached. If the page mainly contains static content or every x Refresh the content once in a while , Then we can cache the page and provide it immediately !
Where to use Redis My first priority is Full page caching (FPC).
Another thing it can do is Storage session , With no persistence Memcached Different ,Redis Have it and allow session storage , Use Redis Processing sessions can improve the user experience when interacting with the site .
Persistence is important for storing sessions , To avoid losing data in key parts of user interaction , for example , Process payment 、 Add items to the shopping cart or request any action as an authenticated user .
The second is Session cache .
Redis Run as a process , And MySQL、PHP、Apache Run the same way as all other services , It uses a lot of RAM Memory , If the server needs more space for heavy upgrade , Then it may choose to kill Redis The process of , under these circumstances , We will experience service downtime and possible data loss , To prevent this from happening ,Redis Built in Master-Slave framework .
This architecture allows us to have additional processes to monitor our main processes , Imitate its commands from the process , Occasionally, the main dump file is copied , To maintain consistency between processes . These monitoring processes are called Slaves, And the main thing is Master.
When the main process is killed , One of the slave processes becomes the master process and handles all requests when the master process restarts , once Master Start again , It will be from Temporary Master Get the dump file and use it as the base , The main process re instantiates the main process , The temporary master process changes back to the slave process again .
But how do we know when the main process is down ? How do we know which Slave Should be master?
Sentinel Yes, it has the function of checking Redis The process of whether the instance is working properly , They are responsible for :
- testing Master Is it down? ;
- Choose who is the temporary master ;
- monitor Master When to return and tell it which dump file to load .
sentry , I guess the name says everything .
General settings usually use a Master、 Two Slave And three Sentinel.
Redis Have a good community and well written documents , If you want to try , You will find a lot of support on their official website .
Redis Official website :
https://redis.io/
边栏推荐
- How many times can the server address and fortress address be entered before the connection is successful? Why did the connection fail?
- How to deploy the API gateway? Is it OK not to use the API gateway?
- Leetcode must review six lintcode (28348455116385)
- 什么是股票线上开户?手机开户安全么?
- Text editor GNU nano 6.0 release!
- API gateway verification token the role of adding a new authentication token in API gateway
- Error message - Customizing incorrectly maintained – in transaction code ML81N
- How to batch output EAN13 code to PDF
- Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)
- Don't let your server run naked -- security configuration after purchasing a new server (Basics)
猜你喜欢

Acl2022 | MVR: multi view document representation for open domain retrieval

使用 Provider 改造屎一样的代码,代码量降低了2/3!

How to improve the content quality of short video, these four elements must be achieved

Intel openvino tool suite advanced course & experiment operation record and learning summary

MySQL de duplication query only keeps one latest record

北大、加州伯克利大学等联合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基于未标记数据的结构化知识的领域自适应文本分类)

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)

ACL2022 | MVR:面向开放域检索的多视角文档表征

万字长文!一文搞懂InheritedWidget 局部刷新机制

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)
随机推荐
In the "Internet +" era, how can the traditional wholesale industry restructure its business model?
How to provide value for banks through customer value Bi analysis
北大、加州伯克利大學等聯合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基於未標記數據的結構化知識的領域自適應文本分類)
Using barcode software to make certificates
BenchCLAMP:评估语义分析语言模型的基准
[log service CLS] one click to start the efficient operation and maintenance journey of Tencent E-Sign
Go language core 36 lectures (go language practice and application 26) -- learning notes
Overall solution for digital transformation of medical supply chain management
How does the fortress machine view the account assigned by the server? What are the specific steps?
How to batch generate video QR code
Second kill design of 100 million level traffic architecture
万字长文!一文搞懂InheritedWidget 局部刷新机制
Command line enumeration, obtaining and modifying time zones
TDD development mode recommendation process
Take you to understand the working process of the browser
Practice of business level disaster recovery switching drill
[js] generate random array
Dart series: smooth as silk, operating files and directories
Shell automatically obtains hardware information
What is stock online account opening? Is it safe to open a mobile account?