Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do i could limit memory use to an service?

Posted on 2010-09-10
5
Medium Priority
?
1,558 Views
Last Modified: 2013-12-16
How do i could limit memory use to an service?.

%MEM of service/ process "drwebd.real" in my linux box its always  around 85-90%...

  PID USER      PR  NI  VIRT  RES  SHR S %CPU     %MEM    TIME+  COMMAND
16097 drweb     16   0 1947m 1.8g  440 D  5.6      90.0   1:03.10 drwebd.real


thanks
0
Comment
Question by:VMWARE
[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
  • 3
  • 2
5 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 2000 total points
ID: 33645761
Hi,
you could try to set the "memory" ulimit for the user "drweb" before starting "drwebd.real". Create a script, if needed, containing the "ulimit" command and the call to "drwebd.real".
As an alternative you could set this value permanently and globally for user "drweb" in /etc/security/limits.conf.
Display all settings with
ulimit -a
and change the "memory" limit by issuing
ulimit -m new_value_in_kilobytes
wmp
0
 

Author Comment

by:VMWARE
ID: 33646200
Hello woolmilkporc,

How do I for  that user "drweb", was limited to 75% of maximum memory, using the second option?

Thanks
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 33646637
To avoid a possible misunderstanding - there is no limit controlling total memory available to all processes belonging to one user!
The virtual memory limit is enforced per process only!
Anyway, to limit the processes started by drweb to "see" only 75% of memory each, add to /etc/security/limits.conf (as root)
drweb     hard     as    (75%_of_memory_in_kilobytes)
drweb     soft      as    (75%_of_memory_in_kilobytes)
This sets both the initial value (soft) as well as the limit up to which the user can change this value by means of "ulimit (hard).
 Remeber to logout and re-login as drweb, once this setting has been changed by root in limits.conf!
0
 

Accepted Solution

by:
VMWARE earned 0 total points
ID: 33657592
Hello woolmilkporc,

could be something of that sort?

drweb           hard                    1572864 (75% of 2GB)
drweb           soft                    1572864

after, its enought restart the service drwebd as root?
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 33657914
Nearly!

drweb           hard            as      1572864
drweb           soft              as      1572864

"as" means "address space" and has to appear literally!

And the first column indicates the userid which is the owner of the process! So "restart the service drwebd as root" sounds a bit strange, since the "ps" output you posted in your question indicates "drweb" as the owner of "drwebd.real"!

The "normal" procedure would consist in starting the process as user "drweb" after a fresh login.

OK, it might be that you actually start drwebd as root and the script/program involved would do a switch to the "drweb" userid. If this is the case you can only try out if it works, because I don't know whether you OS will indeed respect the limit settings of the target userid in such a case - but I think it will.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

636 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