All Projects → hayyp → cherry

hayyp / cherry

Licence: MIT license
cherry: A Minimal HTTP Server

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
Makefile
30231 projects
HTML
75241 projects

Labels

Projects that are alternatives of or similar to cherry

1m Go Tcp Server
benchmarks for implementation of servers which support 1 million connections
Stars: ✭ 1,193 (+5322.73%)
Mutual labels:  epoll
Poseidon
Poseidon Server Framework (refactor WIP)
Stars: ✭ 162 (+636.36%)
Mutual labels:  epoll
Socket.core
This is a socket framework based on C # net standard2.0 write, can be used for .NET Framework / dotnet core assembly, can run in window (IOCP) / linux (epoll) .Use asynchronous connection, asynchronous send, asynchronous receive, Performance burst tables, and pass the stress test. 这是一个基于C# .net standard2.0 写的socket框架,可使用于.net Framework/dotnet core程序集,能在window(IOCP)/linux(epoll)运行.使用异步连接,异步发送,异步接收,性能爆表,并且通过压力测试。
Stars: ✭ 203 (+822.73%)
Mutual labels:  epoll
Tcpsocks
Redirect traffic to SOCKS5 server with iptables, epoll based, single threaded.
Stars: ✭ 78 (+254.55%)
Mutual labels:  epoll
Lotos
tiny but high-performance HTTP Server
Stars: ✭ 140 (+536.36%)
Mutual labels:  epoll
Webserver
High-performance web server written in C++
Stars: ✭ 175 (+695.45%)
Mutual labels:  epoll
Appnet
A Network Server Extension For PHP
Stars: ✭ 72 (+227.27%)
Mutual labels:  epoll
hasses
Hyper's Asynchronous Server Sent event (SSE) notification Server
Stars: ✭ 18 (-18.18%)
Mutual labels:  epoll
Eomaia
一个基于reactor模式的Linux/C++网络库,支持one loop per thread机制。
Stars: ✭ 159 (+622.73%)
Mutual labels:  epoll
Zserver4d
ZServer4D 是一套从商业项目剥离而出的云服务器中间件,可以承载百万级的分布式负载服务,并且支持IoT及内网穿透
Stars: ✭ 199 (+804.55%)
Mutual labels:  epoll
Sincere
Sincere is a micro web framework for Rust(stable) based on hyper and multithreading
Stars: ✭ 91 (+313.64%)
Mutual labels:  epoll
Webserver
A C++ Lightweight Web Server based on Linux epoll
Stars: ✭ 135 (+513.64%)
Mutual labels:  epoll
Vino
Vino is a lightweight and efficient web server.
Stars: ✭ 181 (+722.73%)
Mutual labels:  epoll
Envelop.c
🌊 Thread-less, event-loop based tiny http-server from scratch using epoll. Learning Purpose.
Stars: ✭ 75 (+240.91%)
Mutual labels:  epoll
Mongols
C++ high performance networking with TCP/UDP/RESP/HTTP/WebSocket protocols
Stars: ✭ 250 (+1036.36%)
Mutual labels:  epoll
Memento
Fairly basic redis-like hashmap implementation on top of a epoll TCP server.
Stars: ✭ 74 (+236.36%)
Mutual labels:  epoll
Libuev
Lightweight event loop library for Linux epoll() family APIs
Stars: ✭ 170 (+672.73%)
Mutual labels:  epoll
WebServer
High-performance multi-threaded tcp network server in c++11
Stars: ✭ 58 (+163.64%)
Mutual labels:  epoll
fastsocket
⚠️⚠️⚠️ DEPRECATED
Stars: ✭ 14 (-36.36%)
Mutual labels:  epoll
Wifidog Ng
Next generation WifiDog implemented in Lua.
Stars: ✭ 197 (+795.45%)
Mutual labels:  epoll

cherry: A Minimal HTTP Server

cherry image

Inspired by the Capriccio project and the Zaver HTTP server, cherry started out as an experimental project trying to incorporate cooperative threading (sometimes also known as fibers or coroutines) into a server. Unfortunately, as it turns out, it can be overly sophisticated to achieve the same level of performance as the Capriccio project did.

That said, cherry remains a simple HTTP server designed with unicore performance in mind and tries to boost efficiency by leveraging lightweight mechanisms such as FSM (finite state machine) scheduling and I/O multiplexing (epoll). More importantly, it, hopefully, provides a working example for many of the ideas described in books but maybe not talked about as much anymore. Anyway, perhaps cherry will never be a serious server whatsoever, but from what I can see now, with its simplicity, it can still be a perfect playground for testing new ideas.

Basic design

The basic idea behind cherry is that for unicore servers, there is only one single control flow at all times, and if we can eliminate blocking operations, even without preemptive threading, it's still possible for us to implement almost the same level of concurrency as cooperative threading. Currently, cherry uses

  • epoll(7) to leverage I/O multiplexing

  • a queue to store file descriptors that are ready for I/O operations.

  • a finite state machine to schedule (e.g. when jobs are waiting in the queue, epoll(7) should not block)

With that being said, since we use the edge-triggered mode of epoll(7), we must read through the end of a file descriptor in one go every time, which may also lead to starvation of other waiting file descriptors.

Build

To build cherry, you simply run make from src.

System requirements

Since cherry uses epoll(7), a Linux-specific system call, it runs only on Linux systems.

TODO

  • Configuration file

  • Build-time single-/multi-thread option

  • Installation

  • Support for kqueue

  • Better data structure for task_set

LICENSE

Like many projects of a similar nature, cherry uses a large amount of code from books and websites, and a significant part of the source code used in parsing HTTP requests has come directly from Zaver. For what it's worth, despite its lack of any actual originality, cherry itself as a whole is shamelessly released under the MIT license (while packages used in this project may use a different license).

Copyright 2021 Zee

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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