| « Build kernel for Ubuntu 10.04 | A great site contains many free software » |
Accerlerator Net::HTTP download performance
Link: http://www.ruby-forum.com/topic/73148
Here is a very useful document about net::http performance. It introduces a idea that small buffer used in rbuf_fill causes interior performance of net/http. And he also introduce a workaround. The general idea is override the default behavior. Here are code:
class OverrideInternetMessageIO < Net::InternetMessageIO
def rbuf_fill
timeout(@read_timeout) {
@rbuf << @socket.sysread(65536)
}
end
end
class NewHTTP < Net::HTTP
def NewHTTP.socket_type
OverrideInternetMessageIO
end
end
Feedback awaiting moderation
This post has 6 feedbacks awaiting moderation...