facebook / proxygen

A collection of C++ HTTP libraries including an easy to use HTTP server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persistent Connection not working

SteveSelva opened this issue · comments

I am using proxygen_proxy to proxy connections. While proxying, each request is being handled by different connections even though they all are from the same domain, so its taking so much time to process a single webpage.

While analysing the logs, I came to know that either the session is being shutdown when no active transactions are present or else the downstream is sending EOF.

But the header contains Connection: keep-alive and the Keep-Alive timeout is also 60 seconds but its being closed after single request.

Help me fix it.

commented

First, double checking you are referring to this sample code:

proxygen/httpserver/samples/proxy/ProxyServer.cpp

Second, I'm unsure if you are saying that connections from the client to the proxy are not being re-used (downstream), or the proxy is not re-using connections it makes to the same domain (upstream). If it's the latter, the sample code explicitly opens a new connection per request and doesn't attempt to pool them. You can integrate the SessionPool component (proxygen/lib/http/connpool/) if you want to reuse upstream connections.

If it's downstream connections not being re-used, then your client should control the re-use to the proxy, so long as the Keep-Alive headers are present. Please include verbose logs demonstrating the issue (-v 4).

  1. Yeah, I am referring to that sample code : "ProxyServer.cpp"

  2. Downstream connections are not being re-used, for each request new connection is being established.

  3. Keep-alive headers are present, but still new connection is being made for downstream.

ProxyServer_Logs.txt