All Projects → watsonserve → Webcpp

watsonserve / Webcpp

Licence: gpl-3.0
用C++开发web服务器框架

Programming Languages

cpp
1120 projects

Projects that are alternatives of or similar to Webcpp

Webserver
A C++ High Performance Web Server
Stars: ✭ 4,164 (+18004.35%)
Mutual labels:  thread-pool, epoll, http-server, webserver
Restana
Super fast and minimalist framework for building REST micro-services.
Stars: ✭ 341 (+1382.61%)
Mutual labels:  framework, http-server, webserver
Cppwebframework
​The C++ Web Framework (CWF) is a MVC web framework, Open Source, under MIT License, using C++ with Qt to be used in the development of web applications.
Stars: ✭ 348 (+1413.04%)
Mutual labels:  framework, http-server, webserver
Libhv
🔥 比libevent、libuv更易用的国产网络库。A c/c++ network library for developing TCP/UDP/SSL/HTTP/WebSocket client/server.
Stars: ✭ 3,355 (+14486.96%)
Mutual labels:  http-server, webserver, epoll
Proxy.py
⚡⚡⚡Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging
Stars: ✭ 1,291 (+5513.04%)
Mutual labels:  framework, http-server, webserver
Criollo
A powerful Cocoa web framework and HTTP server for macOS, iOS and tvOS.
Stars: ✭ 229 (+895.65%)
Mutual labels:  framework, http-server, webserver
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (+504.35%)
Mutual labels:  framework, http-server, webserver
Mgx
🌈 A high performance network framework written in c++ (support tcp and http)
Stars: ✭ 15 (-34.78%)
Mutual labels:  http-server, thread-pool, epoll
Comet
Modern PHP framework for building blazing fast REST APIs, CRUDs and microservices
Stars: ✭ 328 (+1326.09%)
Mutual labels:  framework, http-server
Pode
Pode is a Cross-Platform PowerShell web framework for creating REST APIs, Web Sites, and TCP/SMTP servers
Stars: ✭ 329 (+1330.43%)
Mutual labels:  framework, webserver
Neutralinojs
Portable and lightweight cross-platform desktop application development framework
Stars: ✭ 4,731 (+20469.57%)
Mutual labels:  framework, http-server
Nodemcu Httpserver
A (very) simple web server written in Lua for the ESP8266 firmware NodeMCU.
Stars: ✭ 369 (+1504.35%)
Mutual labels:  http-server, webserver
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+20239.13%)
Mutual labels:  thread-pool, framework
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ⚡️🦀
Stars: ✭ 401 (+1643.48%)
Mutual labels:  http-server, webserver
Framework
Swoole, PSR-15, PSR-7, PSR-11 lightweight modular anti-framework for REST micro-services.
Stars: ✭ 259 (+1026.09%)
Mutual labels:  framework, http-server
httoop
HTTOOP - a fully object oriented HTTP protocol library written in python
Stars: ✭ 15 (-34.78%)
Mutual labels:  webserver, http-server
EthernetWebServer
This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and…
Stars: ✭ 118 (+413.04%)
Mutual labels:  webserver, http-server
Facebooc
Yet another Facebook clone written in C
Stars: ✭ 483 (+2000%)
Mutual labels:  epoll, http-server
Polaris
A cross-platform, minimalist web framework for PowerShell
Stars: ✭ 464 (+1917.39%)
Mutual labels:  framework, webserver
Zaver
Yet another fast and efficient HTTP server
Stars: ✭ 673 (+2826.09%)
Mutual labels:  epoll, http-server

webCpp

用C++开发web服务器框架

初衷

  • 传统CGI或fastCGI等由于进程调度等原因导致性能较差
  • Java实现的tomcat、jetty等多采用同步模式,较重的实现方式导致面对一个小的变动总是需要重写依赖,而且运行时真的吃内存真的很有一套
  • python下除了多用类CGI模式,还有鸡肋的线程和作死的2.7 3.xAPI
  • nodejs的异步确实有益,但单线程对于运算密集型就显得乏力,而且对于系统调用等解释器本身没有提供API
  • Go倒是一个很棒的尝试,运行时消耗的内存能比Java低两位数

so

用C++构建一个支持异步IO的,能处理高并发的,运算速度快,且消耗内存少,支持各种方式外部调用的web服务器框架, 也许也是个不错的想法

整体设计

  • 参考了spring AOP的编程思路
  • 效仿node的express框架
  • 不使用xml配置文件,所有配置依靠编程实现
  • 采用异步IO,封装多线程及多路复用
  • 尽量使用单继承和接口化,增强可扩展性

原则

  • 遵循KISS原则
  • 遵循简单可依赖原则
  • 尽量使用C++标准库
  • 尽量使用POSIX标准库
  • 尽量少的内存拷贝
  • 保持轻量级实现,强调中间件扩展

不同平台下的实现

{
  "linux": " POSIX aio", // 以后会添加epoll + POSIX信号量模拟aio
  "BSD系": "kqueue + POSIX信号量模拟aio",
  "SYSTEM V": "poll + POSIX信号量模拟aio",
  "windows": "不支持"
}

目前对于模拟aio采用的是固定线程数线程池模式,后续会改成动态线程池,以满足单次处理时间长的场景

主要类结构

Object: 所有类的最终父类
  │
  ├─Server
  |  |
  |  └─TCPServer: 负债accept
  │
  ├─StreamIO: 封装aio,并提供读写方法
  │
  ├─IOEvents: IO事件接口
  |  |
  |  └─HTTPDispatcher
  |
  ├─MQ<T>: 消息队列
  |
  ├─ThreadPool: 线程池
  |
  ├─Aio: 异步IO
  |
  ├─HTTPGram
  |  |
  |  ├─HTTPRequest
  |  |
  |  ├─HTTPResponse
  |  |
  |  └─HTTPSession
  |
  ├─MiddleWare
  |
  └─Var

使用方法

参看main.cpp

wiki

more...

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].