tags:

views:

22

answers:

1

I am looking to make my web app adjust itself depentent on the mysql serves load. To do this I am using this query.

SELECT (COUNT(*)-1) P.QUERYCOUNT, SUM(P.TIME) QUERYTIME
FROM information_schema.PROCESSLIST P
WHERE P.COMMAND = 'Query'

However it does not make much sense for all the active sessions to run this query incrementally. Instead it seems more logical for a cron job to save the results to a flat file for the others to read incrementally.

Is this the best way to share out the results or is there a better solution?

A: 

If you want to share the results inside of MySQL than you will probably have to create a table to store it.

MySQL does not support global user variables as far as I know.

However... you could also do this from php ofcourse.

WoLpH
Yes that was my plan a php file that ran every few mins that created a php file with a php array in. Then I could just include that file within other pages...?
Pablo
Yes, that would seem the easyest way. Just generate a php file every few minutes and include it from the other files.
WoLpH