[Tutor] Threading...

Alan Gauld alan.gauld at btinternet.com
Sat Apr 25 01:26:11 CEST 2009


"Spencer Parker" <inthefridge at gmail.com> wrote in message 
news:c7a040fa0904241426h70a0c82bhf95e476fe5ed068c at mail.gmail.com...
>I have a script that I want to test MySQL sonnections with.  The way I 
>have
> the script working is to just create connections, but I realized that it 
> is
> going to wait for the first one to stop before starting a new connection. 
> I
> want to throw a ton of open connections at it to see what the connection
> limit is and how it reacts when it hits that shelf.  Would the best route
> for this be threading?  or is there another way to go about it?


Yes threading is probably the way to go but remember that each thread
will take up CPU resource so the limits on performance could be the
client computer rather than the server. Also the network connection
between client and server will have a strong impact on connectivity,
and not just bandwidth, you really need to account for queue latency
on the ports.

Ideally you should be using multiple network connections, multiple ports
per connection and multiple clients if you really want a feel for how a
server will respond under load. Finally, make sure you aren't just 
repeating
the same data request for each hit otherwise locking tests etc will slow
things down too. Its a good idea to have as many rows as you want to
run tests and have alternate queries hit opposite ends of the table,
or better still have several similar tables and round-robin the queries.

Just some common gotchas with database performance testing.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list