Jump to content

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


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.

 

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.