当前位置:网站首页>【sylar】框架篇-Chapter23-模块篇总结
【sylar】框架篇-Chapter23-模块篇总结
2022-07-28 04:25:00 【江湖人称菠萝包】
站在巨人的肩膀上
概述
- 基础模块篇约14个模块。
- 系统篇约2个模块。
- 框架性能测试。
日志模块
- Logger、LogAppender、LogFormatter、LogEvent
配置模块
- ConfigBase、ConfigVar、Config
- 约定优于配置。
线程模块
- Thread、RWMutex、Mutex、Semaphore、SpinLock
协程模块
- Fiber
协程调度模块
- Scheduler
IO 协程调度模块
- IOManager(epoll)、TimerManager(epoll_wait)
- 最重要最复杂的模块。
HOOK 模块
- FdManager、socket、connect
- 例如,配合 IO 协程调度模块一起使用,当 socket 同步读的时候阻塞了,所在协程让出执行权(注意这里如果没有协程,那阻塞的就是线程,线程的数量是有限的),从而实现异步 IO 的效果。
Socket 模块
- Address、Socket
ByteArray 模块
- ByteArray
- 解决网络传输时字节序问题、压缩问题。
Stream 模块
- Stream、SocketStream
TcpServer 模块
- TcpServer
HttpServer 模块
- HttpServer
Servlet 模块
- Servlet、NotFoundServlet、FunctionServlet
- 抽象服务端的逻辑,某个路径映射到某个Servlet。
HttpConnection 模块
- HttpConnection、HttpConnectionPool
- HttpConnectionPool 针对的是长连接的场景。
系统篇
- 系统篇包含了以下内容,但总结起来就是两模块(守护进程模块和环境变量模块):
- 守护进程
- 启动参数解析
- 环境变量
- 配置加载
- Application
压力测试
- 压测工具AB
yum install -y httpd-tools - 编译选项选 -O3,性能最好。
- 留意有没有限制socket句柄等
ulimit -a - 压测 sylar 框架的小程序:examples/my_http_server.cc
- 注意关闭防火墙
service firewalld stop - ab的使用
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 是多少个请求 -c 是多少个连接 -k 是长连接。- 测试结果:
- 短链接:Requests per second: 31714.17 [#/sec] (mean)
- 长链接:Requests per second: 62924.43 [#/sec] (mean)
- 测试结果:
- 和 nginx 比较
sudo yum install epel-release sudo yum update sudo yum install -y nginx sudo nginx // 启动nginx,默认是80端口 sudo netstat -anp | grep nginx // nginx在80端口 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"- 测试结果:
- 短链接:Requests per second: 12548.61 [#/sec] (mean)
- 长链接:Requests per second: 92893.75 [#/sec] (mean)
- 测试结果:
- 和 libevent 比较(sylar测试过,我没有测试)
wget xxx.com/libtool.tar.xz // libtool是automake常用的工具 安装到自己的路径/apps/.. git clone https://github.com/libevent/libevent.git cd libevent ./autogen.sh 安装到自己的路径/apps/.. cd sample // 里面有例子 ./http-server -p 8030 . - 其他小工具
top -H -p 5066(pid) // 看线程的运行情况 yum install -y net-tools // 安装netstat netstat -ntlap | grep 5066 | wc -l // 连接数
广告时间:基于sylar框架实现的小demo(希望给个star)
边栏推荐
- 【sylar】框架篇-Chapter22-辅助模块
- Reading of the paper "attentional encoder network for targeted sentimental classification"
- Cloud native Devops status survey questionnaire solicitation: kodelurover launched jointly with oschina
- Work fishing clock simulator wechat applet source code
- Elementary level of C language -- while, for, do while
- 23 openwrt switch VLAN configuration
- 24-Openwrt dnsmasq
- idea2022更改本地仓库,配置阿里云中央仓库
- Study notes of Gu Yujia on July 27, 2022
- Fedformer MOE module
猜你喜欢

高数_第4章__曲线积分

idea2022更改本地仓库,配置阿里云中央仓库

Construction and use of FTP server and NFS server

Un7.27: common commands of redis database.
![[yolov5 practice 5] traffic sign recognition system based on yolov5 -yolov5 integration pyqt5](/img/81/89b8e38801f706ef396943a79ef4c5.png)
[yolov5 practice 5] traffic sign recognition system based on yolov5 -yolov5 integration pyqt5

Reading the paper "learning span level interactions for aspect sentimental triple extraction"

功耗:Leakage Power

High number_ Chapter 4__ Curvilinear integral_ Exercise solution

MATLB | location and constant volume IEEE30 node implementation of distributed energy

Information system project manager (2022) - key content: intellectual property rights and standards and specifications (22)
随机推荐
Bio annotation of emotion analysis aste triples extraction
《KG-BERT: BERT for Knowledge Graph Completion》
A little advice for students - how to build their own knowledge system?
重要的 SQL Server 函数 - 数字函数
方舟生存进化自建服务器要多少成本?
The State Administration of market supervision exposes typical cases of food safety
pytorch_ Lightning in lightning_ The output of hparams.yaml in logs is null
Full resolution of the use of go native plug-ins
.net upload files through boundary
Seamless support for hugging face community, colossal AI low-cost and easy acceleration of large model
Campus stray cat information recording and sharing applet source code
Kingbasees Security Guide for Jincang database -- 5.1. database transmission security
虚拟机类加载机制
Virtual machine class loading mechanism
Go structure
Information system project manager (2022) - key content: Project Portfolio Management (19)
[blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]
Thoroughly understand the sharing function in wechat games
[yolov5 practice 5] traffic sign recognition system based on yolov5 -yolov5 integration pyqt5
Difference between on, where and having