title: Running some massive task during off-peak period?
body: <p><strong>Background</strong></p>
  
  <p>In one of our project, we need to run some massive task occasionally, e.g., generate reports, send numbers of notification emails. Sometimes it causes noticeable lag when such massive task is being run. So we are thinking of one possible solution.</p>
  
  <p><strong>Some thoughts</strong></p>
  
  <ol>
  <li>Set crontab to run a backend script every 10 minutes.</li>
  <li>Collect the cpu usage info, I found <a href="http://phpsysinfo.sourceforge.net/phpsysinfo/index.php?disp=dynamic" rel="nofollow">http://phpsysinfo.sourceforge.net/phpsysinfo/index.php?disp=dynamic</a> , but I'm not sure if there is a better way?</li>
  <li>If there are contiguous usage lower than a specific value, or the first task in the queue reaches its deadline, the script will get a certain number of tasks from the queue and run.</li>
  </ol>
  
  <p>There are different types of massive task: e.g.,</p>
  
  <ol>
  <li>User can request certain type of report </li>
  <li>Notification emails</li>
  <li>Cleaning data in database</li>
  <li>...</li>
  </ol>
  
  <p>I am wondering if this idea is worth trying?
  Is there any problem, or is there some other better solution?</p>