Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
| # Getting a random free tcp port in python using sockets | |
| def get_free_tcp_port(): | |
| tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| tcp.bind(('', 0)) | |
| addr, port = tcp.getsockname() | |
| tcp.close() | |
| return port | |
| /** | |
| * Hash based KDF | |
| * Implements RFC 5869 :: https://tools.ietf.org/html/rfc5869 | |
| */ | |
| public class HKDF | |
| { | |
| /** | |
| * The HMAC algorithm provider | |
| * @var MacAlgoritimProvider provided | |
| */ |
| """ | |
| The most simple DNS client written for Python with asyncio: | |
| * Only A record is support (no CNAME, no AAAA, no MX, etc.) | |
| * Almost no error handling | |
| * Doesn't support fragmented UDP packets (is it possible?) | |
| """ | |
| import asyncio | |
| import logging |