From owner-freebsd-hackers@FreeBSD.ORG Thu May 12 13:25:10 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6B18216A4CE for ; Thu, 12 May 2005 13:25:10 +0000 (GMT) Received: from titan.whee.org (titan.whee.org [207.195.206.249]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD75B43D3F for ; Thu, 12 May 2005 13:25:09 +0000 (GMT) (envelope-from adam@whee.org) Received: from titan.whee.org (localhost [127.0.0.1]) by titan.whee.org (8.12.9/8.12.9) with ESMTP id j4CDAijX002251 for ; Thu, 12 May 2005 08:10:44 -0500 (CDT) Received: from localhost (adam@localhost) by titan.whee.org (8.12.9/8.12.9/Submit) with ESMTP id j4CDAheE002248 for ; Thu, 12 May 2005 08:10:43 -0500 (CDT) X-Authentication-Warning: titan.whee.org: adam owned process doing -bs Date: Thu, 12 May 2005 08:10:43 -0500 (CDT) From: Adam Maloney X-X-Sender: adam@titan To: freebsd-hackers@freebsd.org In-Reply-To: <6.2.1.2.2.20050512180519.03403540@202.179.0.80> Message-ID: References: <6.2.1.2.2.20050512180519.03403540@202.179.0.80> X-GPG-FINGERPRINT: E39B 8D34 5F0A EA2E 4CCA 5B1D 8D55 7C25 0061 10AF X-GPG-PUBLIC_KEY: http://www.whee.org/~adam/adam-whee-org-pubkey.asc MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Re: upload speed test problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 13:25:10 -0000 On Thu, 12 May 2005, Ganbold wrote: > Result is unbelievable, it is something like 500kbps for 56kbps Dial-Up > connection, which is completely wrong. It looks like the form data that the client is POSTing is all "a", correct? The modem is probably compressing this data. I wrote a speed test in perl a number of years ago to do both upload and download testing. Here are some things I found, maybe they will help you: You must use data that doesn't compress well, or, as you've seen, dial-up modems will compress it and report speeds much higher than is possible. It is better to pre-generate the random data, rather than try and read from /dev/random on the fly. I realized that by having my script suck 5 or 10 megabytes of randomness out of /dev/random every time it ran, I was accelerating the heat-death of the universe. You don't want to cause the heat-death of the universe either, do you? (Actually, either pre-generate random files, or read from /dev/urandom, which doesn't block when it runs out of randomness) IE Sucks. The way my script worked was, I had a form page that the user selected the file size to test with, and hit Submit. This submitted to my CGI that generated a new HTML form with a hidden input field containing the random data of the size they selected. It also contained a hidden field with a timestamp of when the page began to execute. I used javascript to automatically submit the form when the page load completed. Mozilla would submit this form as soon as page load completed. For some odd reason, IE would wait a couple of seconds before submitting the data. So I had to (oh this is so ugly, I don't want to say it), define an IE fudge factor, and subtract a couple of seconds from the upload time if the client was IE. I also realized that I had to add a META tag to cause the pages not to be cached. Furthermore, I had to add something to look at the client's HTTP headers and look for signs of an HTTP proxy (proxies usually add a header or two, depending on how they're configured). If a proxy was detected, I could either spit out a warning to the user that the speeds reported could be inaccurate, or I could simply refuse to continue. On the plus side, overall the test worked pretty well. HTH, Adam