What happens if I start too many background jobs?Where do background jobs go?Is it possible to customise the prompt to show the if there are any background jobs?What happens to suspended jobs in unix?Modify background jobs and/or notify on job completion post-launchLive monitoring of background jobsAre background jobs and foreground jobs always in running state?What happens to background jobs after exiting the shell?How do I wait for background jobs in the background?how to wait for many background jobs in bashHow can we kill all the background jobs (running or not) in the current shell?
Why do freehub and cassette have only one position that matches?
Does hiding behind 5-ft-wide cover give full cover?
Is lying to get "gardening leave" fraud?
Binary Numbers Magic Trick
Short story about people living in a different time streams
I lost my Irish passport. Can I travel to Thailand and back from the UK using my US passport?
Does it look bad as a candidate if I apply to two post-doctoral positions at the same national research laboratory?
Unidentified items in bicycle tube repair kit
Melee attacking upwards (enemy on 10ft ceiling)
Entropy as a function of temperature: is temperature well defined?
Is thermodynamics only applicable to systems in equilibrium?
Feels like I am getting dragged into office politics
Loading but not using TikZ changes a file
Game of Life meets Chaos Theory
How to reply this mail from potential PhD professor?
Why debootstrap can only run as root?
Declining welcome lunch invitation at new job due to Ramadan
Surprising behavior of Part[ ]
What is the most remote airport from the center of the city it supposedly serves?
How to avoid grep command finding commented out strings in the source file?
CRT Oscilloscope - part of the plot is missing
How can I close a gap between my fence and my neighbor's that's on his side of the property line?
Printing a string when grep does not get a match
Accidentally deleted the "/usr/share" folder
What happens if I start too many background jobs?
Where do background jobs go?Is it possible to customise the prompt to show the if there are any background jobs?What happens to suspended jobs in unix?Modify background jobs and/or notify on job completion post-launchLive monitoring of background jobsAre background jobs and foreground jobs always in running state?What happens to background jobs after exiting the shell?How do I wait for background jobs in the background?how to wait for many background jobs in bashHow can we kill all the background jobs (running or not) in the current shell?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a connection and the delay in the output from these devices (old ones). I'm able to establish two connections and have them run in parallel just fine, but how far can I push that?
I don't imagine I could do all 700 of them at once, surely there's some limit to the no. of telnet connections my VM can manage.
If I did try to start 700 of them in some sort of loop like this:
for node in `ls ~/sagLogs/`; do
foo &
done
With
CPU 12 CPUs x Intel(R) Xeon(R) CPU E5649 @ 2.53GHz
Memory 47.94 GB
My question is:
- Could all 700 instances possibly run concurrently?
- How far could I get until my server reaches its limit?
- When that limit is reached, will it just wait to begin the next iteration off
fooor will the box crash?
I'm running in a corporate production environment unfortunately, so I can't exactly just try and see what happens.
bash background-process expect telnet jobs
add a comment |
I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a connection and the delay in the output from these devices (old ones). I'm able to establish two connections and have them run in parallel just fine, but how far can I push that?
I don't imagine I could do all 700 of them at once, surely there's some limit to the no. of telnet connections my VM can manage.
If I did try to start 700 of them in some sort of loop like this:
for node in `ls ~/sagLogs/`; do
foo &
done
With
CPU 12 CPUs x Intel(R) Xeon(R) CPU E5649 @ 2.53GHz
Memory 47.94 GB
My question is:
- Could all 700 instances possibly run concurrently?
- How far could I get until my server reaches its limit?
- When that limit is reached, will it just wait to begin the next iteration off
fooor will the box crash?
I'm running in a corporate production environment unfortunately, so I can't exactly just try and see what happens.
bash background-process expect telnet jobs
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:CPU: 86.9% sys: 13.1% low: 0.0%and RAM readsMem:3.86G used:178M buffers:2.28G cache:608MAny guess?
– KuboMD
4 hours ago
1
I've had good luck withparallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.
– Adam
37 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago
add a comment |
I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a connection and the delay in the output from these devices (old ones). I'm able to establish two connections and have them run in parallel just fine, but how far can I push that?
I don't imagine I could do all 700 of them at once, surely there's some limit to the no. of telnet connections my VM can manage.
If I did try to start 700 of them in some sort of loop like this:
for node in `ls ~/sagLogs/`; do
foo &
done
With
CPU 12 CPUs x Intel(R) Xeon(R) CPU E5649 @ 2.53GHz
Memory 47.94 GB
My question is:
- Could all 700 instances possibly run concurrently?
- How far could I get until my server reaches its limit?
- When that limit is reached, will it just wait to begin the next iteration off
fooor will the box crash?
I'm running in a corporate production environment unfortunately, so I can't exactly just try and see what happens.
bash background-process expect telnet jobs
I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a connection and the delay in the output from these devices (old ones). I'm able to establish two connections and have them run in parallel just fine, but how far can I push that?
I don't imagine I could do all 700 of them at once, surely there's some limit to the no. of telnet connections my VM can manage.
If I did try to start 700 of them in some sort of loop like this:
for node in `ls ~/sagLogs/`; do
foo &
done
With
CPU 12 CPUs x Intel(R) Xeon(R) CPU E5649 @ 2.53GHz
Memory 47.94 GB
My question is:
- Could all 700 instances possibly run concurrently?
- How far could I get until my server reaches its limit?
- When that limit is reached, will it just wait to begin the next iteration off
fooor will the box crash?
I'm running in a corporate production environment unfortunately, so I can't exactly just try and see what happens.
bash background-process expect telnet jobs
bash background-process expect telnet jobs
asked 4 hours ago
KuboMDKuboMD
1938
1938
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:CPU: 86.9% sys: 13.1% low: 0.0%and RAM readsMem:3.86G used:178M buffers:2.28G cache:608MAny guess?
– KuboMD
4 hours ago
1
I've had good luck withparallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.
– Adam
37 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago
add a comment |
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:CPU: 86.9% sys: 13.1% low: 0.0%and RAM readsMem:3.86G used:178M buffers:2.28G cache:608MAny guess?
– KuboMD
4 hours ago
1
I've had good luck withparallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.
– Adam
37 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:
CPU: 86.9% sys: 13.1% low: 0.0% and RAM reads Mem:3.86G used:178M buffers:2.28G cache:608M Any guess?– KuboMD
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:
CPU: 86.9% sys: 13.1% low: 0.0% and RAM reads Mem:3.86G used:178M buffers:2.28G cache:608M Any guess?– KuboMD
4 hours ago
1
1
I've had good luck with
parallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.– Adam
37 mins ago
I've had good luck with
parallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.– Adam
37 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago
add a comment |
2 Answers
2
active
oldest
votes
Could all 700 instances possibly run concurrently?
That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or swap space on the system. UNIX and it's various children are remarkably good at managing huge levels of concurrency, that's part of why they're so popular for large-scale HPC usage.
How far could I get until my server reaches its limit?
This is impossible to answer concretely without a whole lot more info. Pretty much, you need to have enough memory to meet:
- The entire run-time memory requirements of one job, times 700.
- The memory requirements of bash to manage that many jobs (bash is not horrible about this, but the job control isn't exactly memory efficient).
- Any other memory requirements on the system.
Assuming you meet that (again, with only 50GB of RAM, you still ahve to deal with other issues:
- How much CPU time is going to be wasted by bash on job control? Probably not much, but with hundreds of jobs, it could be significant.
- How much network bandwidth is this going to need? Just opening all those connections may swamp your network for a couple of minutes depending on your bandwidth and latency.
- Many other things I probably haven't thought of.
When that limit is reached, will it just wait to begin the next iteration off foo or will the box crash?
It depends on what limit is hit. If it's memory, something will die on the system (more specifically, get killed by the kernel in an attempt to free up memory) or the system itself may crash (it's not unusual to configure systems to intentionally crash when running out of memory). If it's CPU time, it will just keep going without issue, it'll just be impossible to do much else on the system. If it's the network though, you might crash other systems or services.
What you really need here is not to run all the jobs at the same time. Instead, split them into batches, and run all the jobs within a batch at the same time, let them finish, then start the next batch. GUN Parallel can be used for this, but it's less than ideal at that scale in a production environment (if you go with it, don't get too aggressive, like I said, you might swamp the network and affect systems you otherwise would not be touching). I would really recommend looking into a proper network orchestration tool like Ansible (https://www.ansible.com/), as that will not only solve your concurrency issues (Ansible does batching like I mentioned above automatically), but also give you a lot of other useful features to work with (like idempotent execution of tasks, nice status reports, and native integration with a very large number of other tools).
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
add a comment |
It's hard to say specifically how many instances could be run as background jobs in the manner you describe. But a normal server can certainly maintain 700 concurrent connections as long as you do it correctly. Webservers do this all the time.
May I suggest that you use GNU parallel (https://www.gnu.org/software/parallel/) or something similar to accomplish this? It would give you a number of advantages to the background job approach:
- You can easily change the number of concurrent sessions.
- And it will wait until sessions complete before it starts new ones.
- It it easier to abort.
Have a look here for a quick start: https://www.gnu.org/software/parallel/parallel_tutorial.html#A-single-input-source
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516203%2fwhat-happens-if-i-start-too-many-background-jobs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Could all 700 instances possibly run concurrently?
That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or swap space on the system. UNIX and it's various children are remarkably good at managing huge levels of concurrency, that's part of why they're so popular for large-scale HPC usage.
How far could I get until my server reaches its limit?
This is impossible to answer concretely without a whole lot more info. Pretty much, you need to have enough memory to meet:
- The entire run-time memory requirements of one job, times 700.
- The memory requirements of bash to manage that many jobs (bash is not horrible about this, but the job control isn't exactly memory efficient).
- Any other memory requirements on the system.
Assuming you meet that (again, with only 50GB of RAM, you still ahve to deal with other issues:
- How much CPU time is going to be wasted by bash on job control? Probably not much, but with hundreds of jobs, it could be significant.
- How much network bandwidth is this going to need? Just opening all those connections may swamp your network for a couple of minutes depending on your bandwidth and latency.
- Many other things I probably haven't thought of.
When that limit is reached, will it just wait to begin the next iteration off foo or will the box crash?
It depends on what limit is hit. If it's memory, something will die on the system (more specifically, get killed by the kernel in an attempt to free up memory) or the system itself may crash (it's not unusual to configure systems to intentionally crash when running out of memory). If it's CPU time, it will just keep going without issue, it'll just be impossible to do much else on the system. If it's the network though, you might crash other systems or services.
What you really need here is not to run all the jobs at the same time. Instead, split them into batches, and run all the jobs within a batch at the same time, let them finish, then start the next batch. GUN Parallel can be used for this, but it's less than ideal at that scale in a production environment (if you go with it, don't get too aggressive, like I said, you might swamp the network and affect systems you otherwise would not be touching). I would really recommend looking into a proper network orchestration tool like Ansible (https://www.ansible.com/), as that will not only solve your concurrency issues (Ansible does batching like I mentioned above automatically), but also give you a lot of other useful features to work with (like idempotent execution of tasks, nice status reports, and native integration with a very large number of other tools).
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
add a comment |
Could all 700 instances possibly run concurrently?
That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or swap space on the system. UNIX and it's various children are remarkably good at managing huge levels of concurrency, that's part of why they're so popular for large-scale HPC usage.
How far could I get until my server reaches its limit?
This is impossible to answer concretely without a whole lot more info. Pretty much, you need to have enough memory to meet:
- The entire run-time memory requirements of one job, times 700.
- The memory requirements of bash to manage that many jobs (bash is not horrible about this, but the job control isn't exactly memory efficient).
- Any other memory requirements on the system.
Assuming you meet that (again, with only 50GB of RAM, you still ahve to deal with other issues:
- How much CPU time is going to be wasted by bash on job control? Probably not much, but with hundreds of jobs, it could be significant.
- How much network bandwidth is this going to need? Just opening all those connections may swamp your network for a couple of minutes depending on your bandwidth and latency.
- Many other things I probably haven't thought of.
When that limit is reached, will it just wait to begin the next iteration off foo or will the box crash?
It depends on what limit is hit. If it's memory, something will die on the system (more specifically, get killed by the kernel in an attempt to free up memory) or the system itself may crash (it's not unusual to configure systems to intentionally crash when running out of memory). If it's CPU time, it will just keep going without issue, it'll just be impossible to do much else on the system. If it's the network though, you might crash other systems or services.
What you really need here is not to run all the jobs at the same time. Instead, split them into batches, and run all the jobs within a batch at the same time, let them finish, then start the next batch. GUN Parallel can be used for this, but it's less than ideal at that scale in a production environment (if you go with it, don't get too aggressive, like I said, you might swamp the network and affect systems you otherwise would not be touching). I would really recommend looking into a proper network orchestration tool like Ansible (https://www.ansible.com/), as that will not only solve your concurrency issues (Ansible does batching like I mentioned above automatically), but also give you a lot of other useful features to work with (like idempotent execution of tasks, nice status reports, and native integration with a very large number of other tools).
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
add a comment |
Could all 700 instances possibly run concurrently?
That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or swap space on the system. UNIX and it's various children are remarkably good at managing huge levels of concurrency, that's part of why they're so popular for large-scale HPC usage.
How far could I get until my server reaches its limit?
This is impossible to answer concretely without a whole lot more info. Pretty much, you need to have enough memory to meet:
- The entire run-time memory requirements of one job, times 700.
- The memory requirements of bash to manage that many jobs (bash is not horrible about this, but the job control isn't exactly memory efficient).
- Any other memory requirements on the system.
Assuming you meet that (again, with only 50GB of RAM, you still ahve to deal with other issues:
- How much CPU time is going to be wasted by bash on job control? Probably not much, but with hundreds of jobs, it could be significant.
- How much network bandwidth is this going to need? Just opening all those connections may swamp your network for a couple of minutes depending on your bandwidth and latency.
- Many other things I probably haven't thought of.
When that limit is reached, will it just wait to begin the next iteration off foo or will the box crash?
It depends on what limit is hit. If it's memory, something will die on the system (more specifically, get killed by the kernel in an attempt to free up memory) or the system itself may crash (it's not unusual to configure systems to intentionally crash when running out of memory). If it's CPU time, it will just keep going without issue, it'll just be impossible to do much else on the system. If it's the network though, you might crash other systems or services.
What you really need here is not to run all the jobs at the same time. Instead, split them into batches, and run all the jobs within a batch at the same time, let them finish, then start the next batch. GUN Parallel can be used for this, but it's less than ideal at that scale in a production environment (if you go with it, don't get too aggressive, like I said, you might swamp the network and affect systems you otherwise would not be touching). I would really recommend looking into a proper network orchestration tool like Ansible (https://www.ansible.com/), as that will not only solve your concurrency issues (Ansible does batching like I mentioned above automatically), but also give you a lot of other useful features to work with (like idempotent execution of tasks, nice status reports, and native integration with a very large number of other tools).
Could all 700 instances possibly run concurrently?
That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or swap space on the system. UNIX and it's various children are remarkably good at managing huge levels of concurrency, that's part of why they're so popular for large-scale HPC usage.
How far could I get until my server reaches its limit?
This is impossible to answer concretely without a whole lot more info. Pretty much, you need to have enough memory to meet:
- The entire run-time memory requirements of one job, times 700.
- The memory requirements of bash to manage that many jobs (bash is not horrible about this, but the job control isn't exactly memory efficient).
- Any other memory requirements on the system.
Assuming you meet that (again, with only 50GB of RAM, you still ahve to deal with other issues:
- How much CPU time is going to be wasted by bash on job control? Probably not much, but with hundreds of jobs, it could be significant.
- How much network bandwidth is this going to need? Just opening all those connections may swamp your network for a couple of minutes depending on your bandwidth and latency.
- Many other things I probably haven't thought of.
When that limit is reached, will it just wait to begin the next iteration off foo or will the box crash?
It depends on what limit is hit. If it's memory, something will die on the system (more specifically, get killed by the kernel in an attempt to free up memory) or the system itself may crash (it's not unusual to configure systems to intentionally crash when running out of memory). If it's CPU time, it will just keep going without issue, it'll just be impossible to do much else on the system. If it's the network though, you might crash other systems or services.
What you really need here is not to run all the jobs at the same time. Instead, split them into batches, and run all the jobs within a batch at the same time, let them finish, then start the next batch. GUN Parallel can be used for this, but it's less than ideal at that scale in a production environment (if you go with it, don't get too aggressive, like I said, you might swamp the network and affect systems you otherwise would not be touching). I would really recommend looking into a proper network orchestration tool like Ansible (https://www.ansible.com/), as that will not only solve your concurrency issues (Ansible does batching like I mentioned above automatically), but also give you a lot of other useful features to work with (like idempotent execution of tasks, nice status reports, and native integration with a very large number of other tools).
answered 2 hours ago
Austin HemmelgarnAustin Hemmelgarn
6,33111119
6,33111119
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
add a comment |
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
There are ways to run a limited number of background tasks (using bash, perl, python, et al), monitor for task completion, and run more tasks as prior tasks complete. A simple approach would be to collect batches of tasks represented by files in subdirectories, and process a batch at a time. There are other ways...
– ChuckCottrill
34 mins ago
add a comment |
It's hard to say specifically how many instances could be run as background jobs in the manner you describe. But a normal server can certainly maintain 700 concurrent connections as long as you do it correctly. Webservers do this all the time.
May I suggest that you use GNU parallel (https://www.gnu.org/software/parallel/) or something similar to accomplish this? It would give you a number of advantages to the background job approach:
- You can easily change the number of concurrent sessions.
- And it will wait until sessions complete before it starts new ones.
- It it easier to abort.
Have a look here for a quick start: https://www.gnu.org/software/parallel/parallel_tutorial.html#A-single-input-source
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
add a comment |
It's hard to say specifically how many instances could be run as background jobs in the manner you describe. But a normal server can certainly maintain 700 concurrent connections as long as you do it correctly. Webservers do this all the time.
May I suggest that you use GNU parallel (https://www.gnu.org/software/parallel/) or something similar to accomplish this? It would give you a number of advantages to the background job approach:
- You can easily change the number of concurrent sessions.
- And it will wait until sessions complete before it starts new ones.
- It it easier to abort.
Have a look here for a quick start: https://www.gnu.org/software/parallel/parallel_tutorial.html#A-single-input-source
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
add a comment |
It's hard to say specifically how many instances could be run as background jobs in the manner you describe. But a normal server can certainly maintain 700 concurrent connections as long as you do it correctly. Webservers do this all the time.
May I suggest that you use GNU parallel (https://www.gnu.org/software/parallel/) or something similar to accomplish this? It would give you a number of advantages to the background job approach:
- You can easily change the number of concurrent sessions.
- And it will wait until sessions complete before it starts new ones.
- It it easier to abort.
Have a look here for a quick start: https://www.gnu.org/software/parallel/parallel_tutorial.html#A-single-input-source
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
It's hard to say specifically how many instances could be run as background jobs in the manner you describe. But a normal server can certainly maintain 700 concurrent connections as long as you do it correctly. Webservers do this all the time.
May I suggest that you use GNU parallel (https://www.gnu.org/software/parallel/) or something similar to accomplish this? It would give you a number of advantages to the background job approach:
- You can easily change the number of concurrent sessions.
- And it will wait until sessions complete before it starts new ones.
- It it easier to abort.
Have a look here for a quick start: https://www.gnu.org/software/parallel/parallel_tutorial.html#A-single-input-source
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 4 hours ago
laenkeiolaenkeio
1165
1165
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
laenkeio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
add a comment |
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
1
1
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
Interesting! I'll take a look at this. Do you know if attempting this kind of operation (without the help of Parallel) would risk crashing the hypervisor?
– KuboMD
4 hours ago
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516203%2fwhat-happens-if-i-start-too-many-background-jobs%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I’m guessing each job uses very little CPU and RAM, is that right?
– Stephen Kitt
4 hours ago
Honestly I have a hard time telling. Htop isn't very helpful - when I'm running one instance the CPU reads:
CPU: 86.9% sys: 13.1% low: 0.0%and RAM readsMem:3.86G used:178M buffers:2.28G cache:608MAny guess?– KuboMD
4 hours ago
1
I've had good luck with
parallel, using around 50 concurrent jobs. It's a great medium between parallelism of 1 and 700. The other nice thing is that's batchless. A single stalled connection will only stall itself, not any of the others. The main downside is error management. None of these shell-based approaches will gracefully handle errors. You'll have to manually check for success yourself, and do your own retries.– Adam
37 mins ago
Your task queue may be 700 today, but can the size expand? Watch for swap space to grow - that is indication you have reached memory limit. And cpu % is not a good measure (for linux/unix), better to consider load average (run queue length).
– ChuckCottrill
30 mins ago