Solved

best way to slow a php process.

Posted on 2013-06-13
5
295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 57

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 57

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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