Posts: 3,179
Name: Thierry
Location: I'm the uber Spaminator !
|
Quote:
|
Is it possible to determine the number of mysql queries that are running and from there create a script that limits the # of users permitted at one time
|
It doesn't go that way...
Sometimes, it's better to break a very large query with outer joins in a succession of simpler queries.
You cannot say "I allow x users because I want y queries at most".
The type of query, how many joins, how many rows, if there are aggregating functions and the general load of the server are to be taken in account.
If you have a root access to the server and you use mysql, you can try to use mysqltop, which is a mysql monitor.
Another thing to do, is to enable the "slow queries" log, and regularly look in it.
Sometime, optimizing 1 specific query can help tremendously.
But what you need to keep in mind, is that generally optimizing for speed and optimizing for concurrent connection is not the same.
On the db side, optimizing for more concurrent connections often means denormalizing, simplifying joins (and even removing them) by using a cube like structure where everything is in 1 row, without foreign keys, constraints and the like.
__________________
Only a biker knows why a dog sticks his head out the window.
|