CodeIgniter Forums

Full Version: Run a big process
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]marcoslavorato[/eluser]
Hi everyone, how are you?

I have a big problem with my project. I need to ping a list with 300 feeds and save in my database every hour (I will use the cronjob). But, how is the best method to do that without overload my server and database?

El Forum

[eluser]obiron2[/eluser]
I would store the list of feeds in a database table with the last time they were pinged

I would set up the cron job to find the oldest X feeds where the time stamp is < 60 minutes and to ping them in sequence and then update the date time.

If the select statement returns no records, then the cron job doesn't need to run.

You can them play around with the timing of the cron job and the number of records to be returned to determine a suitable load on the server.

El Forum

[eluser]TheFuzzy0ne[/eluser]
I second that. I was thinking the exact same things when I first saw this post, but I was trying to figure out if there was a better way.

You can also use sleep() if you need to during your processing, although I doubt you'll need to.