Friday, June 22, 2007

Increasing Ruby's Net::BufferedIO buffer size

Reading bytes from Net::HTTP seems really slow, around 1Mb/s for a close host. Not many people seem to have complained about this, but I found some insight from Headius and monkey-patched Net::BufferedIO::rbuf_fill. Changing the read buffer size from 1k to 32k brought the throughput up to 24Mb/s.