Giter VIP home page Giter VIP logo

webserver's Introduction

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高性能服务器编程》

webserver's People

Contributors

wangqiim avatar

Stargazers

 avatar Kaede Shiina  avatar

Watchers

 avatar

Forkers

randoruf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.