Jump to content

A question about cron

- - - - -

  • Please log in to reply
3 replies to this topic

#1
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
How does running a cron on your server work in the following circumstance:

The script in your server is recieving hits and for the space of say 1 to 5 seconds a cron.php what it does is it actually stops the script from working.

OR

The script on your server receives the hits but the cron has no effect whatsoever on the effectiveness of your script because all a cron does is clean the database's logs, and logs happen always an instance after what the script has done.

thanks in advance for feedback.

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
I am not sure what you mean by effectiveness, or stopping a script. Cron and PHP are hopefully separate processes, if it clears a log file then it will either clear it before or after the current scripts have ran. There is never really a "collision" where a log is written and cron clears it at the same time.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts

Alexander said:

I am not sure what you mean by effectiveness, or stopping a script. Cron and PHP are hopefully separate processes, if it clears a log file then it will either clear it before or after the current scripts have ran. There is never really a "collision" where a log is written and cron clears it at the same time.

Thanks for the response.

What about server resources in a cron?

Say a server is under a lot of heat from concurrent connections coming in like nuts, I know it's a stretch to wonder this but does a cron consume a lot of server resources and hence worsen the capacity to deal with concurrent connections and therefore the script that depends on them?

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

onething said:

Thanks for the response.

What about server resources in a cron?

Say a server is under a lot of heat from concurrent connections coming in like nuts, I know it's a stretch to wonder this but does a cron consume a lot of server resources and hence worsen the capacity to deal with concurrent connections and therefore the script that depends on them?

You can use a wrench to fix a space shuttle, however you'd be doing it inefficiently. If your cron job only rotates logs or something every time span (hopefully not every minute) then it will probably not cause any major effects.

You can always test with traffic, run a cron script doing whatever it does every ten seconds and record any errors of which may occur if your software is a little buggy if it cannot write as fast as it wants to (probably not an issue with PHP)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users