Timeout procedure for using to much memory or cpu


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Timeout procedure for using to much memory or cpu
# 1  
Old 10-11-2015
Timeout procedure for using to much memory or cpu

How hard is it to create some kind of timeout procedure for using to much memory or cpu on a linux/unix server? What would you have to do to do this?
# 2  
Old 10-11-2015
I don't know what you mean by a "timeout procedure". One can use ulimit to constrain memory and CPU usage by a process or by a user, but those limits don't set a timeout; they kill processes that exceed the established CPU limits and fail attempts to grow a process (such as by calling fork() or malloc()) by users/processes that reach memory allocation limits.
# 3  
Old 10-12-2015
Quote:
Originally Posted by Don Cragun
I don't know what you mean by a "timeout procedure". One can use ulimit to constrain memory and CPU usage by a process or by a user, but those limits don't set a timeout; they kill processes that exceed the established CPU limits and fail attempts to grow a process (such as by calling fork() or malloc()) by users/processes that reach memory allocation limits.
This happens WAY to often. I understand you may need full resources if you are doing something with heavy resources. But when you leave something running for over 3 days that is ABSOLUTELY ridiculous. If you can't get what your doing done in like an hour then you should be it on a personal server. Hundreds of people need to use that server and as you can tell from the screenshot it is an old server with limited resources. Can you think of a way to stop this after like an hour? In this case the person was using 99.9% of the server.

PiXhost - Free Image Hosting

Image
# 4  
Old 10-12-2015
And if no one else is using the system, why shouldn't one user get to use 99.9% of the system? If other users should be run with higher priority, then nice the long running processes so they can run all day, but other processes will get preferential treatment when they do run.

Or, if you think these long running processes should be run on a different server; run them on a different server.

With virtual machines, you could set up resource limits for each virtual machine running on your physical hardware, but you probably aren't going to install virtualization on old hardware.
# 5  
Old 10-15-2015
Quote:
Originally Posted by Don Cragun
And if no one else is using the system, why shouldn't one user get to use 99.9% of the system? If other users should be run with higher priority, then nice the long running processes so they can run all day, but other processes will get preferential treatment when they do run.

Or, if you think these long running processes should be run on a different server; run them on a different server.

With virtual machines, you could set up resource limits for each virtual machine running on your physical hardware, but you probably aren't going to install virtualization on old hardware.
No one else was able to logon to the server for three days.
# 6  
Old 10-15-2015
Having a process run for more than 3 days is perfectly normal.

Being unable to login for 3 days is a completely different issue; and is not even close to normal.
# 7  
Old 10-21-2015
What's your OS?
If you have a recent Linux kernel with cgroups you can try
Code:
echo ‘1' > /proc/sys/kernel/sched_autogroup_enabled

Permanent entry in /etc/sysctl.conf
Code:
kernel.sched_autogroup_enabled = 1

This should better balance the CPU usage between different users. (Yet I have no practical experience.)
--
You can write a script that reads a config file with "procname:cputime" tupels, for example
Code:
x:30
y:1440

That means process "x" may run 30 CPU minutes and process "y" may run 1 CPU day.
The script can check every 10 minutes if any of the running processes exceed these limits, warn the user, and finally kill them (the processes Smilie).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get the memory and cpu usage

what is the best way to get the memory and cpu usage of a process on any system? this is relatively simple. however, i'm looking for a unified method that would work on linux, sunos, hpux, aix. ps -ef | egrep myprocess | awk '{print $4}' ---> there could be several instances of 'myprocess'... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. UNIX for Dummies Questions & Answers

Get CPU,Memory utilization by process id

Hi , We need to get the CPU% and Memory utilization of process by process id. Is there any way to do get them ? I tried few commands like top -p <PID> , but am getting error "Quitting top: pset <PID> doesn't exist" also i tried with ps -eo option but am getting error "ps: illegal option --... (1 Reply)
Discussion started by: suresh_g
1 Replies

3. Solaris

Memory or CPU size

Is there a command or file I can look at that tells me how much real memory a machine has? A little background. In my shop we run a bunch of java programs, sometimes some of these jobs have config definitions that call for 2G. I would like to know how many I can run before I exhaust rescources. Any... (12 Replies)
Discussion started by: Harleyrci
12 Replies

4. Solaris

Regarding cpu & memory utilize

Dear all, i am not getting the exact things what i am expecting from these commands . just clarify this things , 1. cpu utilization (min)% 2.peak load cpu utilization (max) % 3.cpu utilization(avg) 4. peak disk busy % 5. peak kb read 6.peak kb write 7.free memory for... (3 Replies)
Discussion started by: masthan25
3 Replies

5. Solaris

OS is not detected CPU and memory

Hi, Server AIBVRFCC failed POST while booting on 06/28/2009. Server is up, but OS cannot see two CPUs (CPU 0 and CPU 2) and half of the installed system memory (8 GB is physically installed but only 4 GB is seen by OS now). bld00016:root psrinfo 1 on-line since 06/28/09 05:51:36 3 on-line... (1 Reply)
Discussion started by: arumsun
1 Replies

6. UNIX for Dummies Questions & Answers

snmptrapd uses all the CPU and 4 Go memory

Hello all, Below what I saw on my solaris 10 box : $ prstat PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 683 root 4082M 91M run 10 0 41:45:39 96% snmptrapd/1 syslog gives a lot of : snmptrapd: illegal data attempted to be added to table nlmLogVariableTable... (0 Replies)
Discussion started by: Gino_75
0 Replies

7. UNIX for Dummies Questions & Answers

CPU/Memory utilization

hi guys I just want to know how to get the cpu/memory utilization of a running script? Well i know that I can use the sar command but it shows the whole system's statistics. Is it possible to get the stats of a single scirpt or a single running service? (6 Replies)
Discussion started by: khestoi
6 Replies

8. UNIX for Dummies Questions & Answers

cpu, memory and virtual memory usage

Hi All, Does anyone know what the best commands in the UNIX command line are for obtaining this info: current CPU usage memory usage virtual memory usage preferably with date and time parameters too? thanks ocelot (4 Replies)
Discussion started by: ocelot
4 Replies

9. UNIX for Dummies Questions & Answers

Script for CPU and Memory Utilisation

Hi, I want to check the CPU and Memory Utilisation in the whole machine (not for a single process). Can someone send me a ready made script which captures all information in a log every 5min?? Thanks, Ajith (0 Replies)
Discussion started by: Ajith Praveen
0 Replies

10. AIX

Utilization for memory and cpu

Hi all I need command to give me the utilization for memory and cpu,and how can I know if the utilization ok or no? for example in hp unix #top it is give me utilize for cpu and memory and also I can know if utilize ok or no. thanks (2 Replies)
Discussion started by: magasem
2 Replies
Login or Register to Ask a Question