Jump to content

How much CPU and/or memory does running a cron job take?


OM2

Recommended Posts

How much CPU and/or memory does running a cron job take?

OK: like asking how long a piece of string is...?  :)

 

I need to write some code that access an API and updates an XML file.

This should happen every 12 hours, lets just assume.

One cron job, I assume not a problem at all.

 

But... I'm building a website where there could be 5000 members.

Now, let's say each of the members needs to have the same cron job run.

NOW is it more significant?

 

Would it be a good idea to maybe run the cron job on another server and then simply access the same files on this other server?

 

Thanks.

 

 

OM

Cron itself takes up very little cpu, it depends on the scripts you ask it to execute. For that I'm afraid, there is simply no definitive answer.

 

  Quote
Now, let's say each of the members needs to have the same cron job run.

 

That would seem rediculous, design your script in such a way that it should be abble to do whatever it needs to do for all 5000 users in one hit.

  Quote
Use set_time_limit if you think whatever your going to do will exceed a few minutes.

 

set_time_limit is already set to 0 by default in regard to the php-cli. And if your running php scripts through cronjobs, there really isn't much point requesting them through apache.

guys: thanks for the replies.

it does need to be 5000 seperate calls.

each user will need to pull in different data.

5000 is an extreme: if i get to that number, i'll happily invest a lot of money in having several dedicated servers!

 

the bit where u said cron jobs dont use much resources on their own - its more the actual task...

that answered what i needed to know.

thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.