From: Denis Haskin Date: 2008-12-24T03:02:53+09:00 Subject: Net::HTTPResponse#read_body usable for timing? --------------030805050207010505040609 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I have some simple network performance analysis I need to do; easiest and most flexible thing to do would be to use Net::HTTP in Ruby to do this, but I want to make sure I'm getting somewhat realistic results. (Note since I'm mainly using this for comparisons, not specific timings, the numbers don't need to be *exact*, but would be nice if they were close.) In any event, I'm using Net::HTTPResponse#read_body since I want to be able to get intra-download timings, so I've got something like: Net::HTTP.start(url.host, url.port) do |http| http.request_get('/test.txt') do |res| # start timer res.read_body do |fragment| # stop timer, calculate stats for this interval & fragment size # restart timer end end end The numbers I'm getting seem *somewhat* right but vary a lot, particularly because each fragment is pretty small (doc says it's as it comes from the socket). Does anyone know if read_body is synchronous wrt to the network reads? E.g. is it realistic to use this for timing this way? I'll do some comparisons with wget, but any help would be appreciated. Thanks, dwh --------------030805050207010505040609--