From: Eric Wong Date: 2012-01-16T04:20:40+09:00 Subject: [ruby-core:42137] Re: Comments wanted: about merging https://github.com/ruby/ruby/pull/72 Urabe Shyouhei wrote: > Hello, I'm going to merge this pull request "Writing entire packet at once > to avoid incomplete transmission". > > https://github.com/ruby/ruby/pull/72 > > If you have any opinions let me know (either in this list or at the web). Looks good to me. Each @socket.writeline call will correspond to one write(2) and that's bad if you have a lot of small data that is ready to be written. Since TCP_NODELAY isn't enabled in net/http (vs net/http/persistent), Nagle's algorithm will also delay the second packet as it tries to bundle subsequent lines together. This pull request does that in userspace (more efficiently). If TCP_NODELAY were enabled, each @socket.writeline will have 40 bytes of TCP/IP header overhead. Not the end of the world, but not good, either.