Skip to content

HTTP connections - keep-alive / sessions #2056

@iliakarmanov

Description

@iliakarmanov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions