https://github.com/keyan/narwhal
Pre-fork worker model HTTP server
https://github.com/keyan/narwhal
Last synced: about 1 year ago
JSON representation
Pre-fork worker model HTTP server
- Host: GitHub
- URL: https://github.com/keyan/narwhal
- Owner: keyan
- Created: 2019-03-14T19:56:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-16T09:22:08.000Z (over 7 years ago)
- Last Synced: 2025-02-09T00:42:58.882Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# narwhal
A pre-fork worker model Python HTTP server based on the ideas and techniques used in [unicorn](https://bogomips.org/unicorn/) and it's Python port [Gunicorn](https://github.com/benoitc/gunicorn).
This is a learning exercise and not intend to be useful as standalone software. I am working on a potential blog post and hope this source will be a useful reference for others eventually.
## Usage
There are no external dependencies, you only need to have Python3 installed.
```
$ ./narwhal.py --help
usage: narwhal.py [-h] [-w WORKER_COUNT] [-p PORT] [-d]
Run a pre-fork worker HTTP server
optional arguments:
-h, --help show this help message and exit
-w WORKER_COUNT, --worker_count WORKER_COUNT
The number of workers processes to run
-p PORT, --port PORT The port to listen for requests on
-d, --debug If set enables debug level logs
```
Once running you can access `localhost:8080` (default port) in your browser, or via `curl`.
## Performance
Some quick benchmarking using [Siege](https://www.joedog.org/siege-manual/) showed great performance:
```
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 7.94 secs
Data transferred: 0.31 MB
Response time: 0.08 secs
Transaction rate: 1259.45 trans/sec
Throughput: 0.04 MB/sec
Concurrency: 94.59
Successful transactions: 10000
Failed transactions: 0
Longest transaction: 0.33
Shortest transaction: 0.01
```