I had been just wondering what will be the better method to show a graph of '# of visitors' monthlyOr7 days.

1: Write a couple of functions which go off and parse apaches logs then returns an assortment and converts it right into a graph.

2: cronjobs run during the night and place the log files right into a mysql db when the 'client' demands to determine a graph from the site visitors monthlyOr7 days, transmits query to mysql and returns and graphs.

With #1 When i first thought this is advisable however started to consider the toll around the server and it also appears when a person rejuvenated the page the entire process would begin again once the data would more-or-less function as the same(Wasting processor/memory time)

With #2, I believe this is actually the better idea or even the two but wondered if other people did such like and when just how made it happen go.

Any advise could be appreciated.


For those who have a database handy, there is no reason not for doing things. You are able to parse as much as say, one second just before oncoming of script, store that point, and begin again after that the following go-around. You will get the cron to operate as rapidly as every minute with hardly any server impact this way.

Further, in languages like Python and Perl, you are able to run an infinite loop on readline() / readline, and it'll keep coming back either a clear string or even the internet line the moment one is available. Give a short sleep any time you see a clear line and you will have realtime updates having a lengthy-resided process, with no overhead of constant seeks and parses. Naturally you might like to possess a cron that tests if they are alive and revives them otherwise.

I'm able to provide code if you want.