-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable connection pooling #49
base: master
Are you sure you want to change the base?
Conversation
Saves a number of system calls because of connection reuse, below is a comparison of syscall counts - without vs with connection pool for calling send() 1000 times (with 10000 dps in each call) Without connection pool: sigaltstack 2 _lwp_self 33 sigprocmask 66 connect 965 getsockopt 965 recvfrom 965 setsockopt 965 socket 965 issetugid 1930 stat 1930 sendto 1943 fcntl 2895 fstat 3860 poll 3873 close 4826 open 5790 mmap 14139 munmap 14143 With connection pool: sigaltstack 2 _lwp_self 33 sigprocmask 66 fcntl 959 recvfrom 959 issetugid 1916 sendto 1916 stat 1916 fstat 3832 poll 3833 close 3834 open 5748 mmap 12851 munmap 12856 getpeername 1 getsockname 1
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
==========================================
+ Coverage 99.71% 99.71% +<.01%
==========================================
Files 11 11
Lines 1398 1399 +1
==========================================
+ Hits 1394 1395 +1
Misses 4 4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
==========================================
+ Coverage 99.66% 99.66% +<.01%
==========================================
Files 12 12
Lines 1482 1483 +1
==========================================
+ Hits 1477 1478 +1
Misses 5 5
Continue to review full report at Codecov.
|
The requests session needs to be closed as well, otherwise we run risk of leaving open sockets behind. The recommended practice in Python world is to implement the context manager protocol to ensure cleanup. |
Saves a number of system calls because of connection reuse, below is a
comparison of syscall counts - without vs with connection pool for calling
send()
1000 times (with 10,000 dps in each call)Without connection pool:
With connection pool: