Skip to content

Commit

Permalink
1.2.9
Browse files Browse the repository at this point in the history
Add method join.
Fix method shutdown_children to release job_cnt semaphore.
Added echoserver and echclient examples from uvloop and extended them with fastloop support (look at the benchmarks!).
  • Loading branch information
brmmm3 authored Mar 30, 2018
1 parent 0da9a8a commit 8a92bd1
Show file tree
Hide file tree
Showing 9 changed files with 1,093 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.2.9:
Add method join.
Fix method shutdown_children to release job_cnt semaphore.

1.2.8:
Fix global Shutdown method and add option 'now'.

Expand Down
13 changes: 10 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,17 @@ A property which returns the queue for exceptions of failed jobs. The queue is a

A property which returns a semaphore for the failed queue. It can be used to waiting for results without the need for polling.

``shutdown(timeout = None)``
****************************
``join(timeout = None)``
************************

Shutdown the thread pool. A timeout in seconds can be specified. The function returns False if a timeout was specified and the child threads are still busy. In case of a successfull shutdown True is returned.
Wait for all client threads to finish. A timeout in seconds can be specified. The function returns False if a timeout was specified and the child threads are still busy. In case of a successful shutdown True is returned.

``shutdown(timeout = None, wait = False, soon = False)``
********************************************************

Shutdown the thread pool. A timeout in seconds can be specified. The function returns False if a timeout was specified and the child threads are still busy. In case of a successful shutdown True is returned.
If **wait** is True then shutdown will wait until the child threads will finish themselves. So the worker callback functions or another instance has to care about sending the child threads the finish command (call shutdown_children).
If **soon** is True then all pending jobs are skipped.

``cancel(jobid = None, timer = None)``
**************************************
Expand Down
73 changes: 73 additions & 0 deletions doc/echoserver_bench.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
CPU: Ryzen 7, Linux Mint 18.3, kernel 4.13.0-37-generic

Too echoserver and echoclient examples from uvloop project and extended it with fastthreadpool support.
Some benchmarks below. Impressive is the speed if the receive buffer is bigger than the sent message size.
With a big enough buffer fastthreadpool is up to 4 times faster than uvloop with EchoProtocol!

python3.6 echoserver.py --uvloop --proto
python3.6 echoclient.py --workers 5 --times 3

3000000 in 25.72452187538147
116620.243304542 requests/sec

echoserver.py: pool_echo_client with 4096 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3

3000000 in 7.27349328994751
412456.55703652266 requests/sec

python3.6 echoserver.py --uvloop --proto
python3.6 echoclient.py --workers 5 --times 3 --msize 4096

3000000 in 29.3631808757782
102168.76750143619 requests/sec

echoserver.py: pool_echo_client with 8192 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 4096

3000000 in 31.37232756614685
95625.67500529448 requests/sec

echoserver.py: pool_echo_client with 8192 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 4096

3000000 in 12.30263876914978
243850.12486287332 requests/sec

echoserver.py: pool_echo_client with 4096 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 65536

3000000 in 428.21188616752625
7005.877456718546 requests/sec

echoserver.py: pool_echo_client with 65536 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 65536

3000000 in 61.57948875427246
48717.52040636837 requests/sec

echoserver.py: pool_echo_client with 2*65536 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 65536

3000000 in 59.80493211746216
50163.08678534633 requests/sec

echoserver.py: pool_echo_client with 4*65536 bytes buffer size
python3.6 echoserver.py --pool
python3.6 echoclient.py --workers 5 --times 3 --msize 65536

3000000 in 58.558178424835205
51231.10179820185 requests/sec

python3.6 echoserver.py --uvloop --proto
python3.6 echoclient.py --workers 5 --times 3 --msize 65536

3000000 in 122.97190403938293
24395.81645445793 requests/sec

Loading

0 comments on commit 8a92bd1

Please sign in to comment.