当前位置:网站首页>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 to use the serial port assistant in STC ISP?
- ACL2022 | MVR:面向开放域检索的多视角文档表征
- How to improve the content quality of short video, these four elements must be achieved
- CAD图在线Web测量工具代码实现(测量距离、面积、角度等)
- What is dynamic registration? What is static registration?
- 2008R2 CFS with NFS protocol
- Apt attack
- BenchCLAMP:评估语义分析语言模型的基准
- Digital transformation solution for raw material industry chain supply chain platform
- Recommend several idea plug-ins
猜你喜欢

Leetcode algorithm interview sprint sorting algorithm theory (32)

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

How to use the serial port assistant in STC ISP?

Smart cockpit SOC competition upgraded, and domestic 7Nm chips ushered in an important breakthrough

University of North China, Berkeley University of California, etc. | Domain Adaptive Text Classification with structural Knowledge from unlabeled data

Icml2022 | robust task representation for off-line meta reinforcement learning based on contrastive learning

Polar cycle graph and polar fan graph of high order histogram

Installation and use of Minio

Sending network request in wechat applet

Teacher lihongyi from National Taiwan University - grade Descent 2
随机推荐
Shell automatically obtains hardware information
How do fortress computers log in to the server? What is the role of the fortress machine?
2008R2 CFS with NFS protocol
Kubernetes cluster lossless upgrade practice
How does the hybrid cloud realize the IP sec VPN cloud networking dedicated line to realize the interworking between the active and standby intranet?
Use of dotenv in nestjs
Polar cycle graph and polar fan graph of high order histogram
How to set the life cycle of API gateway
CMU博士论文 | 通过记忆的元强化学习,118页pdf
Manually push a message platform
How to use zero to build a computer room
MySQL de duplication query only keeps one latest record
TDD development mode recommendation process
Apt attack
How to use the serial port assistant in STC ISP?
Smart cockpit SOC competition upgraded, and domestic 7Nm chips ushered in an important breakthrough
Take you to understand the lazy loading of pictures
BenchCLAMP:评估语义分析语言模型的基准
How to batch output EAN13 code to PDF
Like playing a game? Take it and use it to build the park scene