i'm need to log some visits on my site to mysql and then parse them, such visits rate is about 50 per second. inserting each request is veryslow and bad, what can you advise me?
+2
A:
Have you tried queueing them on the server and then inserting multiple requests at a time?
danben
2010-01-04 19:22:47
where shoul i queueing them?
Ilya
2010-01-04 19:25:44
A:
Have you considered having a table for the visits per day/hour/minute with your unit of time as a key and then just running inserts into that table with an on duplicate key clause.
feihtthief
2010-01-04 19:28:01
A:
G'day,
Unless you really need statistics in real time, I'd seriously suggest logging the requests to disk and then trawling them later. Using Apache's rotatelogs utility let's you obtain logs for analysis on a daily basis at midnight or on an hourly basis at the top of the hour if you really need a quicker turnaround.
cheers,
Rob Wells
2010-01-04 19:37:17