[Tutor] Threads very simple examle
Alan Gauld
alan.gauld at btinternet.com
Thu Sep 10 11:43:42 CEST 2009
"Oleg Oltar" <oltarasenko at gmail.com> wrote
> I want to create simple load test for my web application.
> Consider the following script:
>
> while 1:
> urllib2.urlopen("www.example.com")
Just a small caveat.
If you try a load test like this from a single PC you might
get very surprising (and non representative) results.
Remember that each request will be sharing a single
network connection, so the performance bottleneck
can very quickly become the network interface not the
server. It depends of course on what you are measuring
and how many threads you want to run. Just be aware of
the full architecture that you are testing to make sure
what you measure is what you mean to measure.
Load testing is a very complex task, frought with potential
for false results. I've seen far more erroneous load tests
than I've seen valid ones!If you on;y want to test for 3 or 4
connections then it is probably OK but if you try running
dozens of concurrent tests it will almost certainly fail to
reflect reality. The same applies to the server of course,
if it only has one network connection then it may bottleneck
there too. But most servers (in a data center environment)
have at least two network interfaces running so its usually
less of an issue.
> How can I make it running in several threads?
I'll leave the threading part to someone else.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list