Hello, I have a LWP application that POSTs thousands of small files to a
mod_perl server. All POSTs *under* a certain size (around 3k) seem to
take about 200x as long as those over. In this case about 0.09 seconds
as opposed to 0.004 seconds.
After much debugging I narrowed the issue down to TCP latency and
discovered I can get around the problem by setting TCP_NODELAY on the
socket.
My workaround is redefining the LWP::Protocol::http::_check_sock()
method and adding a setsockopt($sock, 6, 1, pack("l", 1)). This tweak
significantly improves performance on small POSTs but feels like a total
hack.
Can I be sure that the _check_sock() method will always be there? The
function itself doesn't do anything so I assume its just a hook. Is
there another, better way to do this? Thanks much.
mike