Skip to content

wangqiim/WebServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A C++ High Performance WebServer

based on epoll edge trigger, nonblocking IO, IO & worker thread pool

  • single thread echo server (v1.0.0)
  • single thread http(get) server (v1.0.0)
  • eventloop pool echo server (v2.0.0)
  • eventloop pool http server (v2.0.0)
  • eventloop pool(io thread) & worker thread Pool echo server (v3.0.0)
  • eventloop pool(io thread) & worker thread Pool http server (v3.0.0)

Build

echo server

$ make echoserver

--------------another terminal window--------------------
$ telnet 127.0.0.1 8088


http server

  • support method: GET
  • support Connection: keep-alive
  • 为了让webbench正常收到FIN,当httpserver在短连接时,发送完完整的response就close掉连接
$ make httpserver

Format

need clang-format

$ make format

Performance Test

WebBench
Web性能压力测试之Webbench使用详解

$ make httpserver

--------------another terminal window--------------------
$ webbench -c 20 -t 30 --get -1 http://127.0.0.1:8088/index.html

$ webbench -c 20 -t 30 --get -1 http://127.0.0.1:8088/webbench

Issue

  • HTTP parser state machine 直到session存储整个完整的请求头才解析回复
  • 单线程->iothread pool + 单工作线程-> iothread pool + worker thread pool 发现性能吞吐量越来越低(环境:2核虚拟机ubuntu20.04)

Ref

chenshuo(muduo)
linyacool(WebServer)
chenshuaihao(NetServer)
jayice(NetServre)
《linux多线程服务端编程》
《Linux高性能服务器编程》

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published