当前位置:网站首页>[Sylar] framework Chapter 23 summary of module chapter
[Sylar] framework Chapter 23 summary of module chapter
2022-07-28 04:33:00 【Jianghu people call it pineapple bag】
Standing on the shoulders of giants
Rewrite from scratch sylar C++ High performance distributed server framework
summary
- Basic module is about 14 A module .
- System Chapter 2 A module .
- Frame performance test .
Log module
- Logger、LogAppender、LogFormatter、LogEvent
Configuration module
- ConfigBase、ConfigVar、Config
- Convention over configuration .
Thread module
- Thread、RWMutex、Mutex、Semaphore、SpinLock
Cooperation module
- Fiber
Cooperative scheduling module
- Scheduler
IO Cooperative scheduling module
- IOManager(epoll)、TimerManager(epoll_wait)
- The most important and complex module .
HOOK modular
- FdManager、socket、connect
- for example , coordination IO Used together with the process scheduling module , When socket Blocking during synchronous reading , The agreement gives up the right of execution ( Note that if there is no coordination process here , The blocked thread , The number of threads is limited ), To achieve asynchronous IO The effect of .
Socket modular
- Address、Socket
ByteArray modular
- ByteArray
- Solve the problem of byte order in network transmission 、 Compression issues .
Stream modular
- Stream、SocketStream
TcpServer modular
- TcpServer
HttpServer modular
- HttpServer
Servlet modular
- Servlet、NotFoundServlet、FunctionServlet
- Abstract the logic of the server , A path maps to a Servlet.
HttpConnection modular
- HttpConnection、HttpConnectionPool
- HttpConnectionPool It is aimed at long connection scenarios .
System
- The system chapter includes the following contents , But to sum up, there are two modules ( Daemon module and environment variable module ):
- Daemon
- Start parameter resolution
- environment variable
- Configuration is loaded
- Application
Pressure test
- Pressure measuring tool AB
yum install -y httpd-tools - Compile options -O3, Best performance .
- Pay attention to whether there are restrictions socket Handle, etc
ulimit -a - Pressure measurement sylar Framework applet :examples/my_http_server.cc
- Pay attention to turn off the firewall
service firewalld stop - ab Use
ab --help ab -n 1000000 -c 200 "http://192.168.60.138:8020/sylar" ab -n 1000000 -c 200 -k "http://192.168.60.138:8020/sylar" -n How many requests -c How many connections -k It's a long connection .- test result :
- Short link :Requests per second: 31714.17 [#/sec] (mean)
- Long link :Requests per second: 62924.43 [#/sec] (mean)
- test result :
- and nginx Compare
sudo yum install epel-release sudo yum update sudo yum install -y nginx sudo nginx // start-up nginx, The default is 80 port sudo netstat -anp | grep nginx // nginx stay 80 port ab -n 1000000 -c 200 "http://192.168.60.138:80/sylar" ab -n 1000000 -c 200 -k "http://192.168.60.138:80/sylar"- test result :
- Short link :Requests per second: 12548.61 [#/sec] (mean)
- Long link :Requests per second: 92893.75 [#/sec] (mean)
- test result :
- and libevent Compare (sylar tested , I didn't test )
wget xxx.com/libtool.tar.xz // libtool yes automake Common tools Install to your own path /apps/.. git clone https://github.com/libevent/libevent.git cd libevent ./autogen.sh Install to your own path /apps/.. cd sample // There are examples ./http-server -p 8030 . - Other gadgets
top -H -p 5066(pid) // Look at the operation of the thread yum install -y net-tools // install netstat netstat -ntlap | grep 5066 | wc -l // The number of connections
Advertising time : be based on sylar The implementation of the framework is small demo( I hope to give star)
边栏推荐
- Solana's "deceptive behavior": making mobile phones and opening stores
- 空间复杂度计算超全整理!!(一起手撕复杂度计算
- [Niuke] find 1+2+3+... +n
- What to do when encountering slow SQL? (next)
- Nat fundamentals and private IP
- 【sylar】框架篇-Chapter14-TcpServer 模块
- What is the account opening process of qiniu business school? Is it safe?
- ESP8266 WIFI 模块和手机通信
- Information system project manager (2022) - key content: Project Contract Management (13)
- 写给学生的一点建议-如何构建自己的知识体系?
猜你喜欢

Space complexity calculation super full sorting!! (calculation of hand tearing complexity

MySQL: data types and operators

Ma Yi, Shen Xiangyang, Cao Ying's latest AI overview is hot! It took 3 months to build, netizens: required papers

Pyqt based grouping tool

【实战】使用 Web Animations API 实现一个精确计时的时钟

RN interface jump description

Campus stray cat information recording and sharing applet source code

VAE generation model (with VAE implementation MNIST code)

Transformer landing | next vit realizes the real-time landing of industrial tensorrt, surpassing RESNET and cswin

MySQL:数据类型和运算符
随机推荐
Bio annotation of emotion analysis aste triples extraction
26 openwrt port forwarding DMZ UPnP
【sylar】框架篇-Chapter12-ByteArray 模块
【sylar】框架篇-Chapter20-守护进程模块
物联网工业串口转WiFi模块 无线路由WiFi模块的选型
校园流浪猫信息记录和分享的小程序源码
Important SQL server functions - date functions
could only be written to 0 of the 1 minReplication nodes. There are 0 datanode(s) running and 0 node
《KG-BERT: BERT for Knowledge Graph Completion》
【sylar】框架篇-Chapter21-环境变量模块
【牛客】求1+2+3+...+n
Render the data obtained from the database to the table in elementui
重要的 SQL Server 函数 - 其他函数
Information system project manager (2022) - key content: organization level project management, process management, project set management (18)
[kinematics] simulation of orbital angular momentum based on MATLAB [including Matlab source code 1971]
ESP8266 WIFI 模块和手机通信
Reading of papers on "towards generative aspect based sentimental analysis"
Internet of things industrial serial port to WiFi module wireless routing WiFi module selection
[mathematical modeling] Based on MATLAB seismic exploration Marmousi model [including Matlab source code, 1977]
Virtual machine class loading mechanism