John McCaskey wrote:
Hi,
I think I can shed a bit of light on the topic. There are several reasons
why your multithreaded code is not a good example and would be slower.
1) locking/unlocking mutexes of course does add *some* overhead
*lots* would probably be a better choice here! :)
2) you have a single database connection and are passing it around between
threads thus serializing the actual queries, as such the queries are not
multithreaded at all and your code is kind of a silly use of threading --
this combined with #1 above naturally does make your threaded code slower
But this is what I had in mind though. I wanted to be that way instead of
opening multi threaded connections but, from the looks of it, I guess you
are right and its not really worth the trouble. I have read somewhere that
opening a few connections can be slower but I guess that was probably wrong.
3) "show status" may not be a good example of threaded performance server
side -- A better test would be a variety of different insert queries or
such, or changes to different tables. Depending on your table type some
locking may occur on inserts that can serialize them if you are inserting
the same data or data on the same data page in the database, more disparate
queries however will actually execute in parallel and should see a speed
increase.
I have tried with other queries, some random ones as well, and the results
where very similar.
Thnx,
Lefteris
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]