当前位置:网站首页>【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
边栏推荐
猜你喜欢

Create a virtual environment using pycharm

初识Flask

7月7日国风廿四节气《小暑》来袭!!附..合..成..预..告..

记录下在线扩容服务器遇到的问题 NOCHANGE: partition 1 is size 419428319. it cannot be grown

数藏如何实现WEB3.0社交

数字藏品成文旅产业新热点

At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?

使用pycharm创建虚拟环境

项目不报错,正常运行,无法请求到服务

Flex elastic box item properties
随机推荐
Chapter 8 aggregate function
发售预告:7月22日“大暑”发售,【传统国风廿四节气】夏季发售完毕。
分布式集群架构场景优化解决方案:分布式调度问题
Xshell suddenly failed to connect to the virtual machine
Apache Log4j任意代码执行复现
用于排序的sort方法
raise RuntimeError(‘DataLoader worker (pid(s) {}) exited unexpectedly‘.format(pids_str))RuntimeErro
文件上传漏洞总结
排序与分页,多表查询课后练习
手撸一个简单的RPC(<-_<-)
The project does not report an error, operates normally, and cannot request services
登录时密码错误次数过多,对该用户进行封禁,
分布式集群架构场景优化解决方案:Session共享问题
预告来袭:【豆冰冰】发.售,现.金.抽.奖等你来拿
Regular verification rules of wechat applet mobile number
分布式锁-Redis实现
Flex elastic box
数字藏品“大乱斗”,千亿市场变局将至?
第七章 单行函数
Create a virtual environment using pycharm