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

Have you considered upgrading from http1.0 to http1.1? #6672

Closed
GitBenjamin opened this issue Aug 11, 2023 · 4 comments
Closed

Have you considered upgrading from http1.0 to http1.1? #6672

GitBenjamin opened this issue Aug 11, 2023 · 4 comments
Labels

Comments

@GitBenjamin
Copy link
Contributor

GitBenjamin commented Aug 11, 2023

The built-in HTTP server is a basic HTTP/1.0 server that supports a 'keep-alive' extension. Persistent connections are limited to 512 requests per connection and allow no more than 5 seconds between requests.
Hi, @mjjbell .I've found that osrm supports long connection, but it's not really http1.1. Have you considered upgrading to http1.1?

@mjjbell
Copy link
Member

mjjbell commented Aug 18, 2023

As mentioned in other osrm-routed improvements (e.g. #6113), the HTTP server is basically just the example from the Boost docs. So yes, an upgrade would make sense, but it requires someone to invest the time in doing it.

For now, if you need a production-grade HTTP server for OSRM you can:

  1. Bind the OSRM lib to such an HTTP server using the C++/Node/Python bindings.
  2. Put osrm-routed behind a reverse-proxy that is better suited for handling your networking needs.

@mjjbell
Copy link
Member

mjjbell commented Aug 18, 2023

There's also #6411, which i believe is close to the finish line.

@hy05190134
Copy link

void Connection::start()
{
TCP_socket.async_read_some(boost::asio::buffer(incoming_data_buffer),
boost::bind(&Connection::handle_read,
this->shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));

if (keep_alive)
{
    // Ok, we know it is not a first request, as we switched to keepalive
    timer.cancel();
    timer.expires_from_now(boost::posix_time::seconds(keepalive_timeout));
    timer.async_wait(std::bind(
        &Connection::handle_timeout, this->shared_from_this(), std::placeholders::_1));
}

}

@mjjbell can you explain why should set async_wait repeatly when next request come in. keep-alive mode, I think the implement of keep-alive is not graceful and not effectable

@hy05190134
Copy link

hy05190134 commented Oct 25, 2023

@GitBenjamin I have review the support of osrm network connection, I think if you set HTTP 1.0 to HTTP 1.1 it can work and increase the performance well though it is not the whole feature of HTTP 1.1

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

No branches or pull requests

3 participants