Solved

best way to slow a php process.

Posted on 2013-06-13
5
292 Views
Last Modified: 2013-06-13
I need to be able to slow down a php batch process so that it does not take up too much system resources at certain times.

what's the best way to do this?

cris
0
Comment
Question by:CrisThompsonUK
  • 2
  • 2
5 Comments
 
LVL 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39243799
0
 
LVL 4

Expert Comment

by:BAKADY
ID: 39243815
with sleep(m) you can pause the process for a fixed time in milleseconds (m), but you aren't saving system resources, only the processor.

what do you mean with "at certain times"?
if other batch or program is running at the same time???
0
 

Author Closing Comment

by:CrisThompsonUK
ID: 39243824
thanks julian.
0
 

Author Comment

by:CrisThompsonUK
ID: 39243937
We have lots of processed and things going on, and when the batch is running, we need to make sure that it doesn't use up all the system power and stop the other, user critical processes from working properly.

Some of the batch will hit the database quite hard, so pausing every 10 records of so should allow the other processes in?
0
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 39243982
Yup - that will do it - CPU will stop processing but process will still consume resources (RAM) as it is still alive - if you have lots of RAM then no problem.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question