All Projects → imarvinle → Webserver

imarvinle / Webserver

Licence: mit
A C++ Lightweight Web Server based on Linux epoll

Programming Languages

cpp11
221 projects

Projects that are alternatives of or similar to Webserver

Webserver
High-performance web server written in C++
Stars: ✭ 175 (+29.63%)
Mutual labels:  epoll, webserver
hasses
Hyper's Asynchronous Server Sent event (SSE) notification Server
Stars: ✭ 18 (-86.67%)
Mutual labels:  webserver, epoll
Lotos
tiny but high-performance HTTP Server
Stars: ✭ 140 (+3.7%)
Mutual labels:  epoll, network-programming
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+2385.19%)
Mutual labels:  webserver, epoll
Webserver
A C++ High Performance Web Server
Stars: ✭ 4,164 (+2984.44%)
Mutual labels:  epoll, webserver
fancy
High performance web server
Stars: ✭ 20 (-85.19%)
Mutual labels:  epoll, network-programming
Vino
Vino is a lightweight and efficient web server.
Stars: ✭ 181 (+34.07%)
Mutual labels:  epoll, webserver
Webcpp
用C++开发web服务器框架
Stars: ✭ 23 (-82.96%)
Mutual labels:  epoll, webserver
WebServer
C++高性能网络服务器
Stars: ✭ 53 (-60.74%)
Mutual labels:  webserver, epoll
connect
tiny cross-platform socket API library
Stars: ✭ 46 (-65.93%)
Mutual labels:  epoll, network-programming
Tkeed
🌎 High Performance HTTP WebServer
Stars: ✭ 485 (+259.26%)
Mutual labels:  epoll, network-programming
Gev
🚀Gev is a lightweight, fast non-blocking TCP network library based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers.
Stars: ✭ 1,082 (+701.48%)
Mutual labels:  epoll, network-programming
Divert
WinDivert: Windows Packet Divert
Stars: ✭ 1,318 (+876.3%)
Mutual labels:  network-programming
Microdot
The impossibly small web framework for MicroPython
Stars: ✭ 121 (-10.37%)
Mutual labels:  webserver
Docker
Directus Docker — The Official Docker Container for the Directus Suite
Stars: ✭ 93 (-31.11%)
Mutual labels:  webserver
Evennia
Python MUD/MUX/MUSH/MU* development system
Stars: ✭ 1,309 (+869.63%)
Mutual labels:  webserver
Servez
A simple web server for local web development.
Stars: ✭ 124 (-8.15%)
Mutual labels:  webserver
Php Server
Start a PHP server
Stars: ✭ 119 (-11.85%)
Mutual labels:  webserver
Ytdl Webserver
📻 Webserver for downloading youtube videos. Ready for docker.
Stars: ✭ 1,309 (+869.63%)
Mutual labels:  webserver
Sincere
Sincere is a micro web framework for Rust(stable) based on hyper and multithreading
Stars: ✭ 91 (-32.59%)
Mutual labels:  epoll

A C++ Lightweight Web Server

license Build Status

简介

这是一个轻量级的Web服务器,目前支持GET、HEAD方法处理静态资源。并发模型选择: 单进程+Reactor+非阻塞方式运行。

测试页面: http://marvinle.cn:8080/


Part Ⅰ Part Ⅱ
整体设计 性能测试分析

开发部署环境

  • 操作系统: Ubuntu 16.04

  • 编译器: g++ 5.4

  • 版本控制: git

  • 自动化构建: cmake

  • 集成开发工具: CLion

  • 编辑器: Vim

  • 压测工具:WebBench

Usage

cmake . && make 

./webserver [-p port] [-t thread_numbers]  [-r website_root_path] [-d daemon_run]

核心功能及技术

  • 状态机解析HTTP请求,目前支持 HTTP GET、HEAD方法

  • 添加定时器支持HTTP长连接,定时回调handler处理超时连接

  • 使用 priority queue 实现的最小堆结构管理定时器,使用标记删除,以支持惰性删除,提高性能

  • 使用epoll + 非阻塞IO + 边缘触发(ET) 实现高并发处理请求,使用Reactor编程模型

  • epoll使用EPOLLONESHOT保证一个socket连接在任意时刻都只被一个线程处理

  • 使用线程池提高并发度,并降低频繁创建线程的开销

  • 同步互斥的介绍

  • 使用RAII手法封装互斥器(pthrea_mutex_t)、 条件变量(pthread_cond_t)等线程同步互斥机制,使用RAII管理文件描述符等资源

  • 使用shared_ptr、weak_ptr管理指针,防止内存泄漏

开发计划

  • 添加异步日志系统,记录服务器运行状态
  • 增加json配置文件,支持类似nginx的多网站配置
  • 提供CGI支持
  • 类似nginx的反向代理和负载均衡
  • 必要时增加可复用内存池
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].