Python module urllib3: increase the `maxsize` (max pool size) of HTTPSConnectPool to a host, it make the https request slower - urllib3

I have a code to test the HTTPS requests speed. I use urllib3 module and eventlet.
The code is simple just like below, the pool max size is maxsize=1000.
# -*- coding: utf-8 -*-
import eventlet
eventlet.monkey_patch()
import urllib3
import json
vss=[
"Project_0ef86f5b-59ab-4036-b460-035fba7cbae2",
] * 20
urls = [
"https://123.123.123.244:443/mgmt/tm/ltm/virtual/" + \
"~" + "Project_8a2d7296ae9b4bd4a412eb3cb9aa680e" + "~" + vs
for vs in vss
]
if __name__ == "__main__":
http = urllib3.PoolManager(num_pools=2, maxsize=1000)
headers = urllib3.make_headers(basic_auth='admin:test')
headers['Content-Type'] = "application/json"
body = {"connectionLimit": 123}
encoded_data = json.dumps(body)
pool = eventlet.greenpool.GreenPool()
for url in urls:
pool.spawn(http.request, 'GET', url, headers=headers)
pool.waitall()
I do some hard code to print some time elapses:
[root#ci-4183549-rdo-pzhang test_icontrol]# python icontrol_get_test.py
Build NEW connection time elapse is 0.001942
Build NEW connection time elapse is 0.012094
Build NEW connection time elapse is 0.013818
Build NEW connection time elapse is 0.013012
Build NEW connection time elapse is 0.007247
Build NEW connection time elapse is 0.010341
Build NEW connection time elapse is 0.013482
Build NEW connection time elapse is 0.020885
Build NEW connection time elapse is 0.013927
Build NEW connection time elapse is 0.009739
Build NEW connection time elapse is 0.016819
Build NEW connection time elapse is 0.015231
Build NEW connection time elapse is 0.022680
Build NEW connection time elapse is 0.013895
Build NEW connection time elapse is 0.015198
Build NEW connection time elapse is 0.035994
Build NEW connection time elapse is 0.024190
Build NEW connection time elapse is 0.017719
Build NEW connection time elapse is 0.013729
Build NEW connection time elapse is 0.013873
EVENTLET GREEN SSL time elapse is 0.051242
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.051957
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.054515
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000169
EVENTLET GREEN SSL time elapse is 0.049463
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.049840
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.060299
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000094
EVENTLET GREEN SSL time elapse is 0.047258
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.047623
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.057479
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000150
EVENTLET GREEN SSL time elapse is 0.057035
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.057440
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.069707
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000529
EVENTLET GREEN SSL time elapse is 0.053266
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.053610
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.067651
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000216
EVENTLET GREEN SSL time elapse is 0.058025
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.058406
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.072347
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000122
EVENTLET GREEN SSL time elapse is 0.073248
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.073845
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.095143
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000396
EVENTLET GREEN SSL time elapse is 0.084811
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.085183
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.098409
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000165
EVENTLET GREEN SSL time elapse is 0.084291
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.084646
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.098489
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000523
EVENTLET GREEN SSL time elapse is 0.086874
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.087236
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.094723
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000176
ACTUAL REQUEST time elapse is 0.150891
ACTUAL REQUEST time elapse is 0.166222
ACTUAL REQUEST time elapse is 0.172489
ACTUAL REQUEST time elapse is 0.208163
ACTUAL REQUEST time elapse is 0.223595
ACTUAL REQUEST time elapse is 0.228818
ACTUAL REQUEST time elapse is 0.241930
ACTUAL REQUEST time elapse is 0.234952
ACTUAL REQUEST time elapse is 0.245768
ACTUAL REQUEST time elapse is 0.253769
EVENTLET GREEN SSL time elapse is 6.222013
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.222441
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.239439
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000201
EVENTLET GREEN SSL time elapse is 6.234959
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.235361
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.258194
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000168
EVENTLET GREEN SSL time elapse is 6.241790
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.242165
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.257899
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000671
EVENTLET GREEN SSL time elapse is 6.280445
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.280884
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.295080
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000187
EVENTLET GREEN SSL time elapse is 6.299682
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.300054
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.315421
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000275
EVENTLET GREEN SSL time elapse is 6.308870
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.309240
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.345404
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000193
EVENTLET GREEN SSL time elapse is 6.345892
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.346267
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.360176
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000186
EVENTLET GREEN SSL time elapse is 6.363362
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.363804
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.388216
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000305
EVENTLET GREEN SSL time elapse is 6.368939
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.369322
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.387182
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000407
EVENTLET GREEN SSL time elapse is 6.373431
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 6.373835
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 6.387855
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000180
ACTUAL REQUEST time elapse is 0.172811
ACTUAL REQUEST time elapse is 0.195098
ACTUAL REQUEST time elapse is 0.187940
ACTUAL REQUEST time elapse is 0.136162
ACTUAL REQUEST time elapse is 0.213076
ACTUAL REQUEST time elapse is 0.145465
ACTUAL REQUEST time elapse is 0.194409
ACTUAL REQUEST time elapse is 0.150222
ACTUAL REQUEST time elapse is 0.152019
ACTUAL REQUEST time elapse is 0.182908
From the above log, There are 20 requests sent, I find it very slow to do the first HTTPS connection SSL validation (as log SLOW validate). And it seems every 10 requests is about 5-6 seconds slower than previous requests.
after the SSL validation handshake, I also log the new connection time Build NEW and actual request time ACTUAL REQUEST, they seem faster than the SSL handshake.
The weird things happened, when I change the pool max size to 1 as maxsize=1. the code is just as below:
ACTUAL REQUEST time elapse is 0.166906
# -*- coding: utf-8 -*-
import eventlet
eventlet.monkey_patch()
import urllib3
import json
vss=[
"Project_0ef86f5b-59ab-4036-b460-035fba7cbae2",
] * 20
urls = [
"https://123.123.123.244:443/mgmt/tm/ltm/virtual/" + \
"~" + "Project_8a2d7296ae9b4bd4a412eb3cb9aa680e" + "~" + vs
for vs in vss
]
if __name__ == "__main__":
http = urllib3.PoolManager(num_pools=2, maxsize=1)
headers = urllib3.make_headers(basic_auth='admin:test')
headers['Content-Type'] = "application/json"
body = {"connectionLimit": 123}
encoded_data = json.dumps(body)
pool = eventlet.greenpool.GreenPool()
for url in urls:
pool.spawn(http.request, 'GET', url, headers=headers)
pool.waitall()
The only change is maxsize=1. Then I run the code again. I found it faster than before.
And the log is:
[root#ci-4183549-rdo-pzhang test_icontrol]# python icontrol_get_test.py
Build NEW connection time elapse is 0.015360
Build NEW connection time elapse is 0.017999
Build NEW connection time elapse is 0.025342
Build NEW connection time elapse is 0.021459
Build NEW connection time elapse is 0.023889
Build NEW connection time elapse is 0.026711
Build NEW connection time elapse is 0.031111
Build NEW connection time elapse is 0.027637
Build NEW connection time elapse is 0.023971
Build NEW connection time elapse is 0.025077
Build NEW connection time elapse is 0.030668
Build NEW connection time elapse is 0.029985
Build NEW connection time elapse is 0.034746
Build NEW connection time elapse is 0.028624
Build NEW connection time elapse is 0.029502
Build NEW connection time elapse is 0.037975
Build NEW connection time elapse is 0.036091
Build NEW connection time elapse is 0.031267
Build NEW connection time elapse is 0.022034
Build NEW connection time elapse is 0.021854
EVENTLET GREEN SSL time elapse is 0.050881
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.051288
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.075853
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000185
EVENTLET GREEN SSL time elapse is 0.058581
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.066372
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.084548
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000120
EVENTLET GREEN SSL time elapse is 0.062094
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.062490
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.089335
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000427
EVENTLET GREEN SSL time elapse is 0.060111
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.060585
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.085756
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000099
EVENTLET GREEN SSL time elapse is 0.066614
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.067027
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.088786
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000196
EVENTLET GREEN SSL time elapse is 0.065821
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.066171
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.097392
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000093
EVENTLET GREEN SSL time elapse is 0.082791
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.083365
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.098947
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000248
EVENTLET GREEN SSL time elapse is 0.074760
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.075168
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.099560
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000750
EVENTLET GREEN SSL time elapse is 0.078279
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.078932
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.105360
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000234
EVENTLET GREEN SSL time elapse is 0.076575
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.077019
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.105298
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000373
ACTUAL REQUEST time elapse is 0.151813
ACTUAL REQUEST time elapse is 0.179453
ACTUAL REQUEST time elapse is 0.184682
ACTUAL REQUEST time elapse is 0.207302
EVENTLET GREEN SSL time elapse is 0.270626
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.271068
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.301941
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000250
EVENTLET GREEN SSL time elapse is 0.276534
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.276893
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.307036
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000199
EVENTLET GREEN SSL time elapse is 0.277267
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.277619
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.312475
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000135
ACTUAL REQUEST time elapse is 0.229100
ACTUAL REQUEST time elapse is 0.219073
ACTUAL REQUEST time elapse is 0.241250
ACTUAL REQUEST time elapse is 0.243543
EVENTLET GREEN SSL time elapse is 0.325758
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.326065
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.354829
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000165
EVENTLET GREEN SSL time elapse is 0.329577
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.329849
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.366091
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000175
EVENTLET GREEN SSL time elapse is 0.331157
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.331404
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.361000
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000110
ACTUAL REQUEST time elapse is 0.266746
EVENTLET GREEN SSL time elapse is 0.341352
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.341600
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.379702
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000261
ACTUAL REQUEST time elapse is 0.278251
EVENTLET GREEN SSL time elapse is 0.362323
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.362653
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.394090
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000209
EVENTLET GREEN SSL time elapse is 0.372634
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.372951
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.395210
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000165
ACTUAL REQUEST time elapse is 0.158835
ACTUAL REQUEST time elapse is 0.154795
ACTUAL REQUEST time elapse is 0.180860
EVENTLET GREEN SSL time elapse is 0.457490
URLLIB3 CONNECTION SLOW TIME after build new connection time elapse is 0.457814
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:855: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
InsecureRequestWarning)
SLOW validate connection time elapse is 0.479805
CONNECTIONPOOL after ssl validation Request with ARGS connection time elapse is 0.000156
ACTUAL REQUEST time elapse is 0.165210
ACTUAL REQUEST time elapse is 0.170411
ACTUAL REQUEST time elapse is 0.183082
ACTUAL REQUEST time elapse is 0.182051
ACTUAL REQUEST time elapse is 0.173406
ACTUAL REQUEST time elapse is 0.195164
ACTUAL REQUEST time elapse is 0.144579
As you can see, the SSL validation time SLOW validate for each request is decreased dramatically.
I dig the code to eventlet ssl, and I find it also slow (as log EVENTLET GREEN SSL indicates) when maxsize is 1000, and it becomes faster when the maxsize is 1.
I do not get why it behaves like this. I am sure it may be related to the urllib3 module since its parameter does change the performance.
Anyone could give me some hints, Thanks a lot.

Related

Mule 3 : http listener persistent connections and Connection Idle timeout

I am new to Mule and trying to learn Mule 3 (some of our existing API in production are using Mule 3).
A production application has an HTTPlistener using 'use Persistent connection' and 'connection idle timeout' as default value of 30000 (30 seconds).
My understanding i that if I call the API that listens to the request at this listener from Postman (the REST client), if the request takes more than 30 seconds, it should receive a timeOut error (504).
We added a Thread.sleep in an expression to simulate this behavior.
<expression-component doc:name="Expression"><![CDATA[Thread.sleep(60000);]]></expression-component>
This will cause the sleep to wait for 1 minute, which is greater than 30 seconds configured for a timeout.
However, the request waits for the thread to wake up after 1 minute and returns a successful response.
So I am not sure what is the purpose of 'connection idle timeout' ?
Also, what does 'persistent connection' mean ?
The documentation is vague.
HTTP Persistent Connections are a feature of the HTTP protocol, that the connector implements. The connection idle time indicates how long the persistent connection will remain open if there is no activity. It is not related to a response timeout, that is a timeout on the client side and seems to be what you are expecting. In this case the HTTP Listener is the server and Postman is the client.
A response timeout in the client doesn't has an HTTP status response because the request is aborted. You can get a 504 status if the request is against a proxy and the proxy has a client timeout against a backend. The proxy usually returns a 504 in that scenario.
The documentation for connectors assumes that you are familiar with the protocol or backend concepts. In this case the HTTP protocol.

Does HTTP Keep Alive reduce TLS connections?

I have read multiple threads like thread1, thread2 or thread3 on how tls handshakes are handled and how Keep Alive works.
To me it remains a bit unclear if I can avoid handshakes by using HTTP keep alive.
I have read about full TLS handshakes and abbreviated TLS handshakes. I understand tha you can bypass handshake steps by keeping TLS sessions. I would like to clarify if I can send multiple HTTP1.1 requests by using Keep Alive settings.
HTTP keep alive is not about full and abbreviated TLS handshakes. HTTP keep alive is about reusing the same connection for multiple HTTP requests and responses. This implicitly also reduces the number of TLS handshakes since there is only one TLS handshake done per TCP connection, i.e. in case of HTTP keep alive one TCP and one TLS handshake for multiple HTTP requests.

Apache-Http-Client : Ideal Value for Keep-Alive Timeout

I have a server-client setup, both being Java applications. I am using Spring's RestTemplate with PoolingHttpClientConnectionManager at the client end to call the server. The server (tomcat) has the default keep-alive value of an http-connection as 60 seconds. This means that if the client uses the same connection (lying idle in pool) again after 60 seconds for another request, the server will close the connection. Then, client automatically creates another connection object and sends the request via this connection to the server.
Without going into the code and internal working, I simply want to know that what is the best practice regarding http-client's keep-alive time? Do I
keep the default value (connection is kept-alive indefinitely by the client), OR
set the keep-alive time less than server keep-alive time? In this case http-client will always check, before leasing a connection, that whether that connection has expired or not. If expired, it is discarded from the pool, a new connection is created and leased to the requesting thread.

rabbitmq keepalive timeout error

Below is part of my rabbitmq log file.
=ERROR REPORT==== 22-Dec-2016::09:36:20 ===
closing MQTT connection "xxx.xxx.xxx.xxx:11030 -> xx.xx.xx.xx:1884" (keepalive timeout)
=ERROR REPORT==== 22-Dec-2016::09:36:20 ===
closing MQTT connection "xxx.xxx.xxx.xxx:14653 -> xx.xx.xx.xx:1884" (keepalive timeout)
=ERROR REPORT==== 22-Dec-2016::09:36:22 ===
closing MQTT connection "xxx.xxx.xxx.xxx:14494 -> xx.xx.xx.xx:1884" (keepalive timeout)
I think this is closing MQTT connection by keepalive timeout.
Is this normal?
These are repeatedly shown. so log disk is full.
Is there way of connection is keep alive?
Your clients are failing to send something within the keep alive time
they specified when they connected to the broker. See MQTT specs
section 3.1.2.10 Keep Alive.
Compliant clients would send a PINGREQ to keep the connection alive.

HTTP 1.1 Transfer-Encoding:chunked opens new TCP socket each time

Protocol used: HTTP 1.1
Header includes 'Transfer-Encoding: chunked'
On sending subsequent requests (same request to the same server), containing 'Transfer-Encoding: chunked', I see new TCP socket being opened for each request.
Should the same socket not be used for requests? Why is the socket being terminated each time?
Note:
Requests sent using fiddler

Resources