I'm on a shared hosting platform and would like to throttle the queries in my app so that if the total execution time exceeds a certain amount over a variable time period then I can make the app cool off and then resume later on.
To do this I would like to find out how long each of my queries take in real time and manage it within the app and not by profiling it externally.
I've seen examples in PHP where the time is recorded before and after the query (even phpMyAdmin does this), but this won't work in NodeJS or anything that runs the query asynchronously.
So the question is: how would I go about getting the actual execution time of a query in NodeJS?
For reference I am using this module to query the MySQL db: https://github.com/felixge/node-mysql/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…