Solved

Limit the quantity of process created in parallel in the Task Scheduler 2008

Posted on 2010-11-08
11
646 Views
Last Modified: 2013-11-16
Hi all!
Problem: My code create too much process.
Question: How to limit the quantity on process created in parallel.

Background: for backup zip7 and the Task Scheduler of window 2008 is used. A task performs (Action) zip of all the files in a directory. The result is 1 zip for each file (I don't want 1 zip with all the files).

the action (in the Task Scheduler) is: cmd
the arguments are:
/C FOR %i IN (*.nsf)  DO  "C:\Program Files\7-Zip\7z.exe"  -bd u "\\Server_name\Backup\%~ni.zip" "%~fi">>c:\resuZip.log

Don't care too much if you're not familiar with the syntax, it works, this is not the problem.
The problem is that FOR creates for *each* file a process (like a fork in C) and the server nearly collapses.
How could I limit the creation of parallel tasks ?

Thanks in advance.
Emmanuel
0
Comment
Question by:Emmanuel Gleizer
  • 6
  • 5
11 Comments
 
LVL 7

Assisted Solution

by:TechnoChat
TechnoChat earned 250 total points
ID: 34091588
I don't have any Idea about parallel task, but using "start" command from command line you can set the process priority.

Eg.
start /HIGH application.exe

Diff. switch

LOW         Start application in the IDLE priority class
NORMAL      Start application in the NORMAL priority class
HIGH        Start application in the HIGH priority class
REALTIME    Start application in the REALTIME priority class
ABOVENORMAL Start application in the ABOVENORMAL priority class
BELOWNORMAL Start application in the BELOWNORMAL priority class

Thanks
Saugata
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34093979
Well this is an idea but, I'm afraid it will not help in my case. With this option It would still *create* ~ 250 process that do ZIP: which is intensive for my server.
It would help if the process *creation* itself is done when the system is idle (which would occures when the first ZIP has ended) it would be almost sequential.
I could even accept a solution in which only ONE process is created that will care of the file one after the second.
 
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34099146
This command line tool might help you out..

http://www.activeplus.com/Products/RunFirst

Thanks
Saugata
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34100966
This solution will put (as I understand it) all the process on ONE core... well if put them in a sequence it could be a solution. But if it put them in parallel on one core well the process will nearly never end...
I'll try
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34101500
Just give it a try, Hope for the best..

Thanks
Saugata
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34111283
I found a better solution (I'm testing it) google for "wait for command to complete \before continuing batch file"
start /wait cmd /c .....
would post if it works
0
 
LVL 5

Author Comment

by:Emmanuel Gleizer
ID: 34111323
BTW I tried to use the Runfirst... but didn't find the syntax for "Option starup parameters"  
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34118165
This runfirst tool only works with the executable without any Option starup parameters. But if you are on vista/w7/2008, then you can user start command for the same.

EG.
start /AFFINITY 1 notepad.exe

Thanks
Saugata
0
 
LVL 5

Accepted Solution

by:
Emmanuel Gleizer earned 0 total points
ID: 34224483
Well I must admit that I ask a question that doesn't reflect my problem.

First sorry I ran my code and discovered that it DOESN'T create many tasks as I thaught. It's sequential: each loop is one after the second.
The reason why (I think but I'm not sure) it slow down between loops is that the whole process is is low priority (since it's scheduled MS decide that IO has low priority)
Thus I fact I have to change my code to CREATE the tasks without waiting the end of the preceding loop.
BUT doing this is dangerous and I would get too many process.

I don't know what to do with this question!
I didn't get a real solution to my problem (I'm fare responsible for this since I didn't really described it)
please post your suggestions. my default would be to close it by accept my solution (wich is NOT) and reward you 2.
thanks for the help!
0
 
LVL 7

Expert Comment

by:TechnoChat
ID: 34225793
Most important thing is to solve the problem, no mater it solve by your self or by taking help from some one else. We all here to help each other, and share our knowledge to solve the problem faster, caz we can't live with our problems :)
And thanks for your comments..

Thanks
Saugata
0
 
LVL 5

Author Closing Comment

by:Emmanuel Gleizer
ID: 34272715
The main problem is that I didn't identify what the problem was: In fact NO parallel collapsing server resources… Thanks to TechnoChat for his different ideas
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now