eclipse-archived / ceylon-herd

The Ceylon repository web application
Apache License 2.0
21 stars 11 forks source link

Persistent connections #266

Open tombentley opened 8 years ago

tombentley commented 8 years ago

I see Herd is sending Connection: close. Why aren't we using persistent connections?

quintesse commented 8 years ago

We do ask for them?

tombentley commented 8 years ago

In HTTP 1.1 you don't have to ask for a connection to be persistent, you have to ask for it to be not persistent (https://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.2). Because the server is sending Connection: close it's forcing the client to open a new TCP connection for subsequent resources.

Given the java.net API there's a limited amount you can do to help it reuse connections (https://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html), but while the server is sending Connection: close nothing the client does can make a difference, AFAIU.

But maybe there's a good reason... @FroMage?