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?