This may seem like an obvious question but we have a PHP/MySQL app that runs on Windows 2008 server. The server has about 10 different sites running from it in total. Admin options on the site in question allow an administrator to run reports (through the site) which are huge and can take about 10mins in some cases. These reports are huge mysql queries that display the data on screen. When these reports are running the entire site goes slow for all users. So my questions are:
- Is there a simple way to allocate server resources so if a (website) administrator runs reports, other users can still access the site without performance issues?
- Even though running the report kills the website for all users of that site, it doesn’t affect other sites on the same server. Why is that?
- As mentioned, the report can take about 10 minutes to generate – is
it bad practice to make these kinds of reports available on the
website? Would these typically be generated by overnight scheduled tasks?
Many thanks in advance.
There’s the
LOW_PRIORITYflag, but I’m not sure whether that would have any positive effect, since it’s most likely a table / row locking issue that you’re experiencing. You can get an idea of what’s going on by using theSHOW PROCESSLIST;query.If other websites run fine, it’s even more likely that this is due to database locks (causing your web processes to wait for the lock to get released).
Lastly, it’s always advisable to run big reporting queries overnight (or when the server load is minimal). Having a read replicated slave would also help.