Skip to content
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

HTTP Persistent Connection in osrm-routed #531

Closed
tmpsa opened this issue Dec 7, 2012 · 11 comments
Closed

HTTP Persistent Connection in osrm-routed #531

tmpsa opened this issue Dec 7, 2012 · 11 comments

Comments

@tmpsa
Copy link

tmpsa commented Dec 7, 2012

We are running osrm-routed on a local box, and send thousands of requests to it. Then our client runs out of 'Ephermal Ports', probably because a new HTTP/TCP connection is created for each request.

Does osrm-routed check and use the HTTP header 'Connection: keep-alive' (which should control the SO_KEEPALIVE socket option)? Or does it close the connection immediately? Our client (using Java SDK) sends the header in the request, but the response does not appear to have it.

How, exactly, does osrm-routed handle Persistent Connections?

@drieks
Copy link

drieks commented Aug 22, 2013

Hi,

we have the same setup here. you can work around this on linux by setting this:

# fin timeout, default is 60s, close an TIME_WAIT socket after 2 seconds
echo 2 > /proc/sys/net/ipv4/tcp_fin_timeout

# recycle TIME_WAIT sockets faster:
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

@flohoff
Copy link

flohoff commented Sep 25, 2014

Still a HTTP/1.1 keep alive session would be much preferred. In the end OSRM is that fast that the whole process is latency bound and so tcp handshakes etc add up.

I am having the same issues and tweaking the tcp stack to work around missing features is at most a temporary solution :)

@emiltin
Copy link
Contributor

emiltin commented Sep 25, 2014

depending on your use case - but for maximum speed you can also use osrm as a lib and compile it into your own app

@DennisOSRM
Copy link
Collaborator

or use the NodeJS bindings

@tmpsa
Copy link
Author

tmpsa commented Sep 26, 2014

emiltin: We would love to have osrm as a lib, but last time we checked (in 2012) it was not portable to Windows; it's heavily dependent on a Unix environment. We need to run it on both platforms. So, a portable osrm would be great!
(And making software portable is an effective way to find some bugs, too).

@DennisOSRM
Copy link
Collaborator

We do have Windows support for a couple of months now. The latest binary from develop branch is available here: http://build.project-osrm.org

@flohoff
Copy link

flohoff commented Sep 26, 2014

I am running mostly perl pulling geometrys from a postgis - running osrm and putting back the geometry into the postgis. OSRM working as library with perl bindings would be an option.
A unix domain socket or UDP interface to talk HTTP to the OSRM, or persistent connections would be a preferable way IMHO. Otherwise you would need to write OSRM lib bindings for every little language out there.

@emiltin
Copy link
Contributor

emiltin commented Sep 26, 2014

@woodbri created postgresql extentions/tools for interfacing with osrm: https://github.com/woodbri/osrm-tools#postgresql

@mehany
Copy link

mehany commented Oct 28, 2015

Hi, does this issue still persist? @drieks do I still need to apply the work around you suggested? and where?

@drieks
Copy link

drieks commented Oct 28, 2015

Hi @mehany, sorry but I can't tell you because I'm not working on this for some time...

@TheMarex
Copy link
Member

The example HTTP server is really not suited very well for production. We mostly keep it around for debugging and make small deployments easier. I would highly recommend to use the node bindings or the C++ API if you really have production requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants