< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事
N :次の記事(スレッド移動)
|<:スレッドの先頭
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
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>