cardoso_tiago / hotmail.com wrote: > Buffers are indeed attached per socket, but I wouldn't say > they are short-lived. Also, I don't have guarantees that the > same thread will handle the same socket after a wait, so I > can't follow your advice. But I can also say that I haven't > seen a big performance degradation because of it (although I'd > appreciate suggestions on tools that could help me inspect > this). From your original post: def read(io) io.read_nonblock(16_384, @buffer, exception: false) # do stuff... @buffer.clear end It looks like @buffer only get used for the duration of the method. For common HTTP (and other TCP-based) servers, often you can read an entire request with one read(2) syscall, do all parsing, and discard the buffer ASAP (before even performing expensive request parsing or response writing). I only need to create a longer-lived buffer when a request is big or trickled due to slowness. Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>