Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/williame/hellepoll
A blazingly-fast async HTTP server written in C++
https://github.com/williame/hellepoll
Last synced: 11 days ago
JSON representation
A blazingly-fast async HTTP server written in C++
- Host: GitHub
- URL: https://github.com/williame/hellepoll
- Owner: williame
- License: other
- Created: 2011-10-27T10:42:51.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-05T15:13:26.000Z (almost 13 years ago)
- Last Synced: 2024-08-02T14:07:54.597Z (4 months ago)
- Language: C
- Homepage:
- Size: 366 KB
- Stars: 251
- Watchers: 11
- Forks: 22
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
***Hellepoll*** is a simple asynchronous web-server written in C++.
It is available under the standard Simplified BSD License; see the LICENSE file for details.
Speed
-----You only write this kind of code if you are concerned about speed :)
benchmarkTornado (Python)node.jsdeft (Java)Hellepoll
ab -c252K9K13K18K/s
ab -k -c257K?30K60K/s+(At 40K/sec on my laptop I am running out of memory bandwidth, and my CPU is not maxed out yet. Numbers ought to be higher on normal server-like hardware.)
Where to start?
---------------Look at helloworld.cpp. Its mostly about parsing commandline arguments, but in there is a simple class that prints "Hello world" on every request. Can't start simplier than that!
Status
------It is very much alpha code, mostly for those wanting to build their own inner guts and just want code to glance at.
It would be nice to imagine it growing into a proper 'tornado for C++' but that's a long way off.
Helloworld is an example simple HTTP server that is included, and used in speed benchmarking.
Architecture
------------It is built around an asynchronous IO loop, which is the scheduler class; currently this is epoll, but in prinicple it could be kqueue or equivilent. It can use edge-triggering, and if used it will check that you sate the stream in your slice.
You would have one instance of the scheduler class for each thread. Ideally, your server is single threaded so you don't have to worry about locking and such, just run a separate process instance for each core that you have.
In the IO loop are any number of tasks - half a million is not so scary.
Protocol handlers - such as HTTP - use state machines to track their progress.
Todo
----- HTTP server should have a handler factory instead, based on the address and the registration of regexes or stems or something
- For non-chunked keep-alive replies, all writes should be buffered so the content-length can be computed by the framework
- Profile and improve speed of inner loop
- Integrate async file IO too
- Profile and improve speed e.g. play with ```writev()```
- ```scheduler.add_callback()``` and general helpers for writing async programs
- A templating system for HTML
- Errors reported to task handlers
- More built-in handlers e.g. async memcached, redis, even SQL somehow