当前位置:网站首页>【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
边栏推荐
猜你喜欢
随机推荐
Books - the art of lucid thinking
CTF常见加密方式JS
数据仓库工具superset安装(完全可用)
mysql多表查询
Kotlin语言现在怎么不火了?你怎么看?
文旅头部结合数字藏品效应显著,但如何支撑用户持续购买力
The combination of cultural tourism and digital collections has a significant effect, but how to support users' continuous purchasing power
变量,流程控制与游标
Variables, process control and cursors
Distributed cluster architecture scenario optimization solution: distributed ID solution
第八章 聚合函数
Data warehouse tool superset installation (fully available)
Invalid packaging for parent POM x, must be “pom“ but is “jar“ @
ModuleNotFoundError: No module named ‘pip‘
1:开启慢查询日志 与 找到慢SQL
记某淘宝客软件分析拿库思路
On July 7, the national wind 24 solar terms "Xiaoshu" came!! Attachment.. cooperation.. completion.. advance.. report
分布式集群架构场景优化解决方案:分布式ID解决方案
mysql 触发器
Idempotent component









