Link to home
Start Free TrialLog in
Avatar of Neil Brookes
Neil BrookesFlag for United Kingdom of Great Britain and Northern Ireland

asked on

HTTP Time out error when a report request is sent to a server following a table rebuild

We've recently written a couple of reporting programs in PHP and Javascript for our own bespoke software that reads data from a table to return tonnage, sales, costs and margin by customer.
The table has a cron job that rebuilds the table twice daily, currenly at around 2am and then again around 1pm.
We find that the first user to run a report following a table update, that the server call times out returning a HTTP time out error on screen.
Is there a reason, that anyone knows of as to why it only happens on the first server call?
If we close down the window and re-open to run the report again it works without issue and get a normal response time of a couple of seconds.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neil Brookes

ASKER

Thanks Ray, it's certainly worth looking in to and testing overnight.
Avatar of David Favor
Try rewriting your CRON job as follows...

1) Add debugging + logging logic to your CRON job to describe what's occurring.

2) Run a database repair on your specific database, something like this...

mysqlcheck --defaults-extra-file=/etc/mysql/debian.cnf --auto-repair -o your-database-name | egrep Error

You should see no errors.

3) Run your normal rebuild logic.

4) Run another database repair. Again you should see no errors.

5) Follow Ray's suggestion. Use curl or PhantomJS to exactly emulate the first user access. This include logging into your system + traversing through all pages. If JavaScript is involved, likely PhantomJS will be required.