-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
HTTP connections - keep-alive / sessions #2056
Copy link
Copy link
Closed
Description
I notice that when I submit HTTP requests to the graphhopper server I am able to get 2000 a second using a HTTPConnectionPool and multiprocessing in python. However, if I use the exact same code but connect to the OSRM server for some reason the requests per second become super slow (perhaps 10 a second):
conn_pool = HTTPConnectionPool(host='localhost', port=5000, maxsize=cpu_count())
def ReqOsrm(data):
url, qid = data
try:
response = conn_pool.request('GET', url)
json_geocode = json.loads(response.data.decode('utf-8'))
...
# Run:
url_routes = CreateUrls(routes_csv)
pool = Pool(cpu_count())
calc_routes = pool.map(ReqOsrm, url_routes)
I'm not too sure why this may be. If I don't use a connectionpool then I run out of ports as it's very fast and creates a new TCP connection for each request.
This leads me to believe it is something to do with the server-routing.exe
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels