Skip to content

Bocabbage/httpancake-webserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebServer(Httpancake): self-learning project

Introduction

A simple C++ webserver for responsing HTTP-request(s). It's a self-learning project which draws heavily on the design of the following projects:

Different from these projects, this webserver is implemented based on C++11 standard library (e.g., std::thread, std::mutex).

Environment

  • Ubuntu 20.04
  • gcc 9.3.0 [g++]

Usage

【STILL DIRTY NOW】 Hard-coding the server-address-port and source path, make it and run:

./build/bin/httpancake

Technical Points

  • Configuration interface
  • Reactor server model
  • EventLoop threadpool [One-loop-per-thread]
  • Simple async log system
  • HTTP-request parsing & responsing [GET]
  • Use Timers to shutdown idle connections
  • MySQL connection-pool

Test Results

Environment

  • Windows 10 WSL2: Ubuntu22.04
  • CPU: Intel Core i5-8265U
  • 8GB RAM

Test-tools

Configuration

  • The Logger-system was disabled
  • ThreadPool size: 4

Summary

QPS
Short-Connection 23,825
Long-Connection 35,014

Details

  • Short-connection result
./webbench -2 -c 1000 -t 60 http://127.0.0.1:9981/hello.html
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Request:
GET /hello.html HTTP/1.1
User-Agent: WebBench 1.5
Host: 127.0.0.1
Connection: close


Runing info: 1000 clients, running 60 sec.

Speed=1429491 pages/min, 3288001 bytes/sec.
Requests: 1429491 susceed, 0 failed.
  • Long-connection result
./webbench -k -2 -c 1000 -t 60 http://127.0.0.1:9981/hello.html
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Request:
GET /hello.html HTTP/1.1
User-Agent: WebBench 1.5
Host: 127.0.0.1
Connection: Keep-Alive


Runing info: 1000 clients, running 60 sec.

Speed=2100869 pages/min, 5007071 bytes/sec.
Requests: 2100869 susceed, 0 failed.

About

Simple self-learning project: WebServer(httpancake).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published