当前位置:网站首页>Linux server development, redis protocol and asynchronous mode
Linux server development, redis protocol and asynchronous mode
2022-07-07 07:54:00 【Tuen Mun pheasant calls me chicken】
Recommend a free open course of zero sound College , Personally, I think the teacher spoke well , Share with you :Linux,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK, Streaming media ,CDN,P2P,K8S,Docker,TCP/IP, coroutines ,DPDK Etc , Learn now
1.redis The network layer of
single reactor Model
2.redis Of pipeline
redis It's a request response .pipeline Is a client behavior , It can send multiple commands at once , Back together , At least one round-trip time is saved .
lua Multiple statements can be written in a script , And you can have your own logic ,lua The form ability of is relatively strong and atomic . because lua A script is just a command ,redis A single thread , So nature has atomicity .
client script load xxx.lua Send to server , Generate 40 Bit string as a flag script , Reduce network transmission
- A: When you reach a certain state, you can return to the original state .redis It's not atomic , Rollback is not supported .
- C: Constraints are to remain intact ,redis There is no consistency in the traditional sense , For example, add money and reduce money , There are successes and failures .
- I: Single thread execution , All have isolation .
- D: Four persistence strategies .redis It's persistent .
3.redis The business of multi exec lua
adopt MULTI and EXEC The command defines the scope of the transaction . adopt wacth Command lock key, If key Automatically cancel the transaction when changes occur . Usually use lua Scripts handle transactions . It's not transactional , Atomicity , The main goal is to reduce the time of network transmission .
4.redis pub/sub
5. Asynchronous connection
skynet Adopt asynchronous connection .
Four aspects to be realized in the future
- Single threaded reactor
- Multithreading reactor, One in charge listen,8 Threads are responsible for operating the network IO
- Ctrip eliminates callback ,go Language understanding is more profound
- Implement a third-party agreement ,redis,MySql,etcd
边栏推荐
猜你喜欢
随机推荐
【p2p】本地抓包
Value sequence (subsequence contribution problem)
微博发布案例
[SUCTF 2019]Game
Button wizard collection learning - mineral medicine collection and running map
leetcode:105. Constructing binary trees from preorder and inorder traversal sequences
C语言航班订票系统
【斯坦福计网CS144项目】Lab4: TCPConnection
[webrtc] m98 Screen and Window Collection
IPv4 exercises
快速使用 Jacoco 代码覆盖率统计
海思芯片(hi3516dv300)uboot镜像生成过程详解
Use and analysis of dot function in numpy
今日现货白银操作建议
nacos
2022-07-06:以下go语言代码是否会panic?A:会;B:不会。 package main import “C“ func main() { var ch chan struct
Button wizard script learning - about tmall grabbing red envelopes
[CV] Wu Enda machine learning course notes | Chapter 8
Gslx680 touch screen driver source code analysis (gslx680. C)
Iterable、Collection、List 的常见方法签名以及含义