当前位置:网站首页>【1】 Introduction to redis
【1】 Introduction to redis
2022-07-28 06:04:00 【ymony】
List of articles
One 、Redis brief introduction
Redis What is it? ?
- Redis It's open source (BSD The license ) Of , Data structure storage system in memory , It can be used as a database 、 Caching and message middleware ;
- Redis Support multiple types of data structures , Such as character string (strings), hash (hashes), list (lists), aggregate (sets), Ordered set (sorted sets) , Range queries , bitmaps, hyperloglogs and Geographical space (geospatial) Index radius query ;
- Redis Built in copy (replication),LUA Script (Lua scripting),LRU Driving events (LRU eviction), Business (transactions) And different levels of Disk persistence (persistence);
- Redis adopt sentry (Sentinel) And clusters (Cluster) Provide high availability (high availability).
Redis characteristic
Fast
- Single node read 110000 Time /s, Write 81000 Time /s
- Data is stored in memory
- use C Language implementation , Closer to the operating system
- Single thread Architecture ,6.0 Start to support multithreading (CPU、IO Read and write load )
Persistence
- Data updates will be saved asynchronously to the hard disk (RDB and AOF)
Multiple data structures - It's not just about supporting simple key-value Type data , And support : character string 、hash、 list 、 aggregate 、 Ordered set ,
Support for multiple programming languages
Rich in functions
- HyperLogLog、GEO、 Publish subscribe 、Lua Script 、 Business 、Pipeline、Bitmaps,key Be overdue
Simple and stable
- Less source code 、 Single thread model
Master slave copy
Redis Support data backup (master-slave) With clusters ( Fragmentation storage ), And have a sentinel monitoring mechanism .
Redis All operations of are atomic , meanwhile Redis It also supports atomic execution after several operations are combined
Redis Typical usage scenarios
cache
Counter (inc command )
Message queue ( General message queues use special middleware ),
Ranking List ( Ordered set implementation )
Social networks ( give the thumbs-up , And so on , Social network traffic is generally large , Traditional relational database is not suitable )
Distributed session ( So much tomcat share session)
Distributed lock
Redis High concurrency principle
- Redis Is a pure memory database , It's usually a simple access operation , Threads take up a lot of time , The time spent is mainly focused on IO On , So the reading speed is fast
- Redis Use non blocking IO,IO Multiplexing , Single thread used to poll descriptor , Open database 、 Turn off 、 read 、 Write all converted to events , Reduce context switching and competition during thread switching .
- Redis Single thread model is adopted , Ensure the atomicity of each operation , It also reduces context switching and competition of threads .
- Redis Storage structure diversification , Different data structures optimize data storage , For example, compressed table , Compress and store short data , Again , Jump watch , Use ordered data structure to speed up reading .
- Redis Using the event separator realized by ourselves , High efficiency , Non blocking internal execution , Large throughput .
Article reference :https://mp.weixin.qq.com/s/-3fcK4WspGk6SEsaVrdx8A
边栏推荐
猜你喜欢
随机推荐
MySQL trigger
【二】redis基础命令与使用场景
Flink CDC (Mysql为例)
Distributed lock database implementation
Tornado初识
Books - mob
ModuleNotFoundError: No module named ‘pip‘
3:Mysql 主从复制搭建
Chapter 7 single line function
Mars数*字*藏*品*平*台守卫者计划细节公布
Hit your face ins? Mars digital collection platform explores digital collection light social networking
出游不易,看景区用数字藏品刷存在感
命令注入绕过方式总结
Create a virtual environment using pycharm
MySQL view, stored procedure and stored function
【六】redis缓存策略
Distributed cluster architecture scenario optimization solution: distributed ID solution
路由器与交换机的区别
(php毕业设计)基于thinkphp5校园新闻发布管理系统获取
On July 7, the national wind 24 solar terms "Xiaoshu" came!! Attachment.. cooperation.. completion.. advance.. report









