public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Need assistance in determining memory usage
@ 2002-11-04 21:11 Dan Kegel
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Kegel @ 2002-11-04 21:11 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Thomas Schenk

  Thomas Schenk <tschenk@origin.ea.com> wrote:
 > We are building an online game system.  On some of
 > the systems, there are simulator processes running
 > that each service a player.  There may be up to
 > 200 or more of these processes running at any given
 > time and each uses a fairly large amount of memory
 > ...  When the simulator processes start swapping,
 > the systems are becoming unstable, performance goes
 > all to hell...  It would
 > be useful for us to be able to monitor as closely as
 > possible the amount of memory each processes is using
 > and especially to be notified when these processes
 > start using significant amounts of swap, so that we
 > can be prepared to react before the situation gets
 > out of hand.  The other reason why we want to collect
 > this data is so that the developers can analyze the
 > process when it starts to swap ...

A few things you might try:

1. Set RLIMIT_DATA or RLIMIT_AS for your processes
using ulimit.  That should cause malloc() and the
like to return NULL or throw an exception if you go
over the limit.  (RLIMIT_AS doesn't work too well
on heavily multithreaded programs, though, because
of the many stacks.)

2. Try the no-overcommit patch.  That will fail
allocation requests that might conceivably cause swapping
later.  Harsh, but you did want early notification :-)

3. Start reading the kernel source to see how it calculates
memory use and enforces the above limits.  That helped
clarify things for me a bit.

4. If you're feeling really nasty, you could try applying
my patch that implements RLIMIT_RSS by killing the process.
That's pretty immediate feedback, too :-)

- Dan



^ permalink raw reply	[flat|nested] 8+ messages in thread
* Need assistance in determining memory usage
@ 2002-11-04 18:11 Thomas Schenk
  2002-11-04 18:18 ` bert hubert
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Schenk @ 2002-11-04 18:11 UTC (permalink / raw)
  To: LKML

Greetings all.

I have been asked a question by some of the developers in my
organization and after searching Google, scouring the Linux newsgroups,
and searching as many mailing list archives and howtos as I could find,
I still cannot find a satisfactory answer to the following question:

Q. How can you determine how much memory a process is using at a given
point in time?  Specifically, I want to know of a method or tool that
will tell me how much total memory a process is using, how much of that
total is shared with other processes, how much is resident, and how much
is swapped out.

Please don't say to just use ps or top, because if either of these tools
was adequate, I wouldn't be asking here and every reference I could find
indicates that this is not a trivial problem.  There were also
indications I found while searching that these tools do not always
report memory numbers accurately.  If there is a way to determine this
information using /proc, this would be ideal, since I could then
conceivably create a script or simple program that could determine the
answer given the process ID, which is what the developers here really
want.

If you can assist me in determining the answer to this question, I would
greatly appreciate it.  Please note that I am far from being a kernel
expert (being just a lowly systems administrator), so please keep make
your explanations as detailed as possible.

Tom S.

-- 
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| Tom Schenk      | A positive attitude may not solve all your    |
| Online Ops      | problems, but it will annoy enough people to  |
| tschenk@ea.com  | make it worth the effort. -- Herm Albright    |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-11-06 19:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-04 21:11 Need assistance in determining memory usage Dan Kegel
  -- strict thread matches above, loose matches on Subject: below --
2002-11-04 18:11 Thomas Schenk
2002-11-04 18:18 ` bert hubert
2002-11-04 18:34 ` Ketil Froyn
2002-11-04 18:40 ` Richard B. Johnson
2002-11-04 19:01 ` Alan Cox
2002-11-04 19:22   ` Thomas Schenk
2002-11-06 19:42     ` Andy Isaacson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox