?
Solved

How do i could limit memory use to an service?

Posted on 2010-09-10
5
Medium Priority
?
1,547 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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