xcw-coder / Webserver
Licence: mit
High-performance web server written in C++
Stars: ✭ 175
Programming Languages
cpp11
221 projects
Projects that are alternatives of or similar to Webserver
Vino
Vino is a lightweight and efficient web server.
Stars: ✭ 181 (+3.43%)
Mutual labels: epoll, webserver
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+1817.14%)
Mutual labels: webserver, epoll
Webserver
A C++ High Performance Web Server
Stars: ✭ 4,164 (+2279.43%)
Mutual labels: epoll, webserver
Webserver
A C++ Lightweight Web Server based on Linux epoll
Stars: ✭ 135 (-22.86%)
Mutual labels: epoll, webserver
hasses
Hyper's Asynchronous Server Sent event (SSE) notification Server
Stars: ✭ 18 (-89.71%)
Mutual labels: webserver, epoll
Mypoorwebserver
基于tinyhttpd和《Linux高性能服务器编程》改编的个人破产版HTTP WebServer服务器,哈哈~
Stars: ✭ 150 (-14.29%)
Mutual labels: webserver
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (-20.57%)
Mutual labels: webserver
Goserv
A lightweight toolkit for web applications in Go
Stars: ✭ 132 (-24.57%)
Mutual labels: webserver
Owasp Mth3l3m3nt Framework
OWASP Mth3l3m3nt Framework is a penetration testing aiding tool and exploitation framework. It fosters a principle of attack the web using the web as well as pentest on the go through its responsive interface.
Stars: ✭ 139 (-20.57%)
Mutual labels: webserver
Libuev
Lightweight event loop library for Linux epoll() family APIs
Stars: ✭ 170 (-2.86%)
Mutual labels: epoll
Gulp Server Io
Standalone / gulp (stream) / delivery server setup with Proxy options remote debugger and more
Stars: ✭ 152 (-13.14%)
Mutual labels: webserver
Uhttpsharp
A very lightweight & simple embedded http server for c#
Stars: ✭ 151 (-13.71%)
Mutual labels: webserver
Simple Server
A simple webserver built on top of the Rust standard library and the http crate.
Stars: ✭ 162 (-7.43%)
Mutual labels: webserver
Nginx
A fairly flexible and feature full Ansible role for the NGINX web server.
Stars: ✭ 151 (-13.71%)
Mutual labels: webserver
High-performance web server written in C++
本项目已经在 https://travis-ci.org 网站上通过了编译,详情可点击左上角绿色的passing图标进行查看。
项目简介
本项目为C++11编写的Web服务器,解析了get、head请求,可处理静态资源,支持HTTP长连接,支持管线化请求,并实现了异步日志,记录服务器运行状态。
Part I | Part II | Part III | Part IV | Part V | Part VI | Part VII |
---|---|---|---|---|---|---|
并发模型 | 连接维护 | 测试及改进 | 项目目的 | 遇到的困难 | 版本历史 | 面试问题 |
开发环境
- OS: Ubuntu 16.04
- Complier: g++ 5.4
编译
./build.sh
使用方法
./WebServer [-t thread_numbers] [-p port] [-l log_file_path(should begin with '/')]
技术要点
- 使用Epoll边沿触发的IO多路复用技术,非阻塞IO,使用Reactor模式
- 使用多线程充分利用多核CPU,并使用线程池避免线程频繁创建销毁的开销
- 使用基于小根堆的定时器关闭超时请求
- 主线程只负责accept请求,并以Round Robin的方式分发给其它IO线程(兼计算线程),锁的争用只会出现在主线程和某一特定线程中
- 使用eventfd实现了线程的异步唤醒
- 使用双缓冲区技术实现了简单的异步日志系统
- 为减少内存泄漏的可能,使用智能指针等RAII机制
- 使用状态机解析了HTTP请求,支持管线化
- 支持优雅关闭连接
模型选择
并发模型为Reactors+非阻塞IO,新连接采用Round Robin(轮叫)的方式分配,详细介绍请参考并发模型
代码统计
其他
除了项目基本的代码,用开源测试工具Webbench来对服务器进行压测。
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].