-
Notifications
You must be signed in to change notification settings - Fork 644
Performance headache #27
Description
This excerpt from stackoverflow
**
"When you make requests with "Connection: keep-alive" the subsequent request to the server will use the same TCP connection. This is called HTTP persistent connection. This helps in reduction CPU load on server side and improves latency/response time.
If a request is made with "Connection: close" this indicates that once the request has been made the server needs to close the connection. And so for each request a new TCP connection will be established.
By default HTTP 1.1 client/server uses keep-alive where as HTTP 1.0 client/server dont support keep-alive by default."
**
From your code, I understand that you force to browser to close the connection immediately.
private static void WriteConnectResponse(StreamWriter clientStreamWriter, string httpVersion) { clientStreamWriter.WriteLine(httpVersion + " 200 Connection established"); clientStreamWriter.WriteLine("Timestamp: {0}", DateTime.Now); clientStreamWriter.WriteLine("connection:close");// <-- This line force the browser disconnect. clientStreamWriter.WriteLine(); clientStreamWriter.Flush(); }
And establishing a secure connection takes too long time.
With this current version, although it runs almost perfect but the performance is really headache.
Is it because of not supporting the persistent connection or not as I am thinking or anything else?
Please reconsider the design issue of this wonderful work.
Lastly, anyhow many thanks for your effort and sharing it to community.