Skip to main content


Showing posts from May, 2013

TCP Recycle

TCP connection tear down is one part which is least documented in the internet. In an ideal web server client architecture, once the server sends FIN, client will send FIN+ACK, server sends an ACK and enters time wait state. Look at this diagram Now lets consider our problem. We have deployed new servers which receive huge traffic with less processing time(100 ms). Now all these connections enter into time wait state to tear down connection. Time Wait state is useful for two reasons If the last ack sent by the server is missed half way, client will retransmit Fin+Ack. If the socket was reused by some other connection, there would be confusions in the network If  a router malfunctioned and any of the data from client to server was lost. Client would have retransmitted it after RTO (retransmission timeout) , There is a high probability that router might reinject the old packet if its segment lifetime is less than MSL. Now this packet could also cause conflict if the same tc

HTTP Range Header

There was a huge attack on our infrastructure couple of days before. It didnt follow the regular pattern. So did a lot of googling (google verb!) but eventually we were not to able to successfully find the intricacies employed in the attack. During this literature reference, I came across Partial Get feature in HTTP header. This is the feature used by Download Managers like IDM by spawning multiple threads to download a file. The partial Get request specifies the byte ranges it requires to download. Eg GET / HTTP/1.1 Host: Range: bytes=0-89 The request requires first 89bytes of the file. There can be more than one chunk requested in the range header. The webserver responds with a 206 code for partial GET. I have coded a primitive threaded downloader which spawns 10 threads, downloads 10 different chunks of a big file and unite them as a single file. Committed the initial version at github . Pl

Amateur Project ii

I have decided to port few of my projects (poorly maintained in app engine) as android apps. Today I ported the chatbot to android. It is very dumb now. Will continue developing the project iteratively. Please do check out the apk file for pre-alpha version here  and give your suggestions by dropping a  mail .