title: How to judge if a per-minute cron wont overload our web (Apache) server
body: <p>Just curious how I can judge performance on this one. We're running Apache with a PHP/Postgresql based products/shopping website.</p>
  
  <p>We have 2 servers - one for the website (PHP scripts, all static content) and one for the database.</p>
  
  <p>Our orders run with a remote payment gateway as follows:
  1. Customer completes checkout on the web server
  2. Customer then is redirected to the payment gateway for payment.
  3. A notification is then sent to our web server script (from the payment gateway) to inform us of the status of the order. At this point, we check if the payment was successful and then place the order to the client's stock system accordingly.</p>
  
  <p>Now, on step 3, we have a situation where we need to do some tasks, pause for 60 seconds (this is a custom workaround for the client's stock reservation system until it is upgraded later in the future), and then continue with the remainder tasks. The "pause for 60 seconds" is the part I'm not sure about. The script needs to literally wait for a while (one minute) and then we do the other tasks (transfer the order to our client).</p>
  
  <p>I can think of doing this in two ways:</p>
  
  <p>a) We set a timeout/interval on the PHP script for 60 seconds, and then finish the job. This is probably not workable since we are dealing with a payment gateway and we do not know if they will timeout or if any issues can happen here.</p>
  
  <p>OR</p>
  
  <p>b) We do the first round of tasks, and then, a cron runs every 60 seconds to check for incomplete order transfers, and then does the balance work for us. The cron needs to run every 60 seconds to catch those orders that are to be sent to the client.</p>
  
  <p>The web server has a number of crons running, mostly at off peak times. Can anyone advise:</p>
  
  <ul>
  <li><p>If you can see a different solution to the above</p></li>
  <li><p>If you agree with solution b), could this be somewhat of an overload to our web server? What is the best way for me to judge this? The task itself it not demanding (checks database, transfers a file from one place to another on our web server), but I'm wondering if a cron should execute every minute like that.</p></li>
  </ul>
  
  <p>Thanks,
  Rishi</p>