Jump to content
MakeWebGames

[Speed Optimization]Running a Cron EVERY SECOND! Free code!


Recommended Posts

Posted

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Make this a cron, and make it run every minute. It will restart every minute, but it will run for 1 second for 60 loops. As soon as its done, the cron restarts and continues running. I have tested it and it works. Its great for codes that slow down header.php, large operations/checks can be moved here to put not even a dent in the server load, whereas putting them in header would slow down loading by at least 1 or 2 seconds.

Posted
And why would you even need a second cron :S

Because we have one for days and minutes. Why not seconds?

Regarding the bandwidth: This is only good for people with unlimited bandwidth, if your host limits you, keep it light.

I suppose it could take a lot up, IF you overload it, can someone explain to me how this would destroy your bandwidth if it just runs a little script that removes people from prison if they are under level 5?

Posted

Well i suppose it wont, now that i think about it. I forgot that the server executes the PHP either way, rather than the user executing it(Oops, getting too used to C++), this is just forcing it to execute every second rather than once per click. Oh well, i guess i need to find a new way to run big scripts without problem. :(

Posted

End it all,

sleep() is underrated for sure.

He tried he failed but he shared which we bash him for, that I apologize , however your ideology isn't bad but it's not going to work,

Posted

nice try, but again timestamps (if used correctly) will be much better as you can run that code once rather then 86,400 times a day! :wacko:

Posted

why is it when people talk about mcc cb is not around yet he is always around to get rid of posts :S

anyways this mod still fails nice idea but put more work into it (even you said the way you put it out was bad but i think db get rid of that post)

Posted

This code is useful, however, in a situation where you need it ran once a second, but its being ran 10 times a second because its in header.php. Say theres lots of people clicking at once, the script is unnecessarily ran more than once per second. If you were to take advantage of this, you would actually lighten the load on your server, right? It seems to work for me, correct me if im wrong.

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.   Paste as plain text instead

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