Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wenzhang-dev/httpserver
A webserver developed using modern c++
https://github.com/wenzhang-dev/httpserver
cplusplus-11 http linux raii webserver
Last synced: about 1 month ago
JSON representation
A webserver developed using modern c++
- Host: GitHub
- URL: https://github.com/wenzhang-dev/httpserver
- Owner: wenzhang-dev
- License: mit
- Created: 2019-12-17T11:03:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-19T08:15:01.000Z (almost 5 years ago)
- Last Synced: 2024-10-12T16:22:50.096Z (about 1 month ago)
- Topics: cplusplus-11, http, linux, raii, webserver
- Language: C++
- Homepage:
- Size: 1.72 MB
- Stars: 47
- Watchers: 4
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
HttpServer Project
==========
A webserver developed using modern c++[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
# Introduction
该项目参考muduo实现了一个多线程静态的web服务器。HttpServer采用c++11编写,支持Http中head、post和get
请求,使用epoll ET边沿触发来提高实时性。HttpServer支持短连接、长连接,并采用timerfd实现了应用层心跳。# Environment
Ubuntu 16.04 i5-8G
gcc-5.4 g++-5.4# Usage
* 编译
make -j4
cd webbench && make
* 运行
./run.sh
./webbench.sh
# Architecture
该项目采用经典的reactor+NIO+thread pool+epoll ET模型设计而成。利用多核的优势,可显著提升实时响应能力。
![architecture](pic/1.png)# Performance Test
使用linux压测工具webbench,分别测试10k连接下,keepAlive和non-keepAlive请求。
60s本地压力测试,响应能力为15 million requests/min, 传输速度为34.64 M/s 。
60s同网段内测试,响应能力为0.75 million requests/min, 传输速度为1.67 M/s。# Others
* 代码统计
![code](pic/code.png)* 内存泄露检测
使用valgrid中memcheck工具,检测HttpServer内存泄露情况。
测试方法: ./memcheck.sh* 资源监控
使用top命令和/proc/${PID}/中内省,检测HttpServer运行时CPU利用率,内存以及文件描述符使用情况。
使用方法: ./monitor.sh