Archive for October, 2009

TCP Speed Tuning

I’m working on a project that has required me to do some Java socket programming.  All was going well until I uploaded my code to the VPS I’m using, and suddenly the upload speeds I was able to attain posting data to the server sucked.  I mean really sucked, like 4 KB/Sec bad.  My first thought was the connection my hosting company uses, but I was able to upload files via FTP at more than 100 KB/sec, so it must have been something to do with my application.  After a little Googling, I came across this great article that describes the problem I ran into and potential fixes.

http://onlamp.com/pub/a/onlamp/2005/11/17/tcp_tuning.html

The short of it was that the toolkit I was using had a ridiculously low default buffer size set on the socket, so I was basically limited to about 32000 bits per second coming in.  The solution was simple: specify a higher buffer size when setting up the socket, and I was back in business at over 100KB/sec!