what commands show memory usage

2013-05-14 Thread Joe

When stopping vnet jails get message about lost memory pages.
What console commands show available memory pages so I can determine the 
lost memory pages after 100 stopped jails?

Want to find out if that lost memory page message is bogus or not.

Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: what commands show memory usage

2013-05-14 Thread Tim Daneliuk

On 05/14/2013 08:56 PM, Joe wrote:

Tim Daneliuk wrote:

On 05/14/2013 08:32 PM, Joe wrote:

When stopping vnet jails get message about lost memory pages.
What console commands show available memory pages so I can determine the lost 
memory pages after 100 stopped jails?
Want to find out if that lost memory page message is bogus or not.



Look at 'vmstat' and 'free' commands.



can't find any free command



Sorry Joe (and everyone), I had a brief bit flip.  The command is
actually called freebsd-memory and is not in the base system.
It's an addon from Ralph Engelshall and can be found here:

   http://people.freebsd.org/~rse/utils/

(If you care, the 'free' command is how you do this on Linux.)

--

Tim Daneliuk tun...@tundraware.com
PGP Key: http://www.tundraware.com/PGP/

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


issue with limiting java's memory usage

2012-01-29 Thread Alexander Best
hi there,

maybe i'm missing something obvious, but i don't quite understand the following
top(1) output:

last pid: 13875;  load averages:  0.73,  0.75,  0.68
65 processes:  2 running, 62 sleeping, 1 waiting
CPU 0: 19.5% user,  0.0% nice, 13.3% system,  0.0% interrupt, 67.2% idle
CPU 1: 20.3% user,  0.0% nice,  7.8% system,  0.0% interrupt, 71.9% idle
Mem: 1365M Active, 185M Inact, 323M Wired, 69M Cache, 213M Buf, 32M Free
Swap: 10G Total, 2494M Used, 7746M Free, 24% Inuse, 4K In

  PIDUIDTHR PRI NICE   SIZERES STATE   C   TIME   WCPU COMMAND
 6913   1001 32  200  4252M  1312M uwait   0  18.3H 39.06% 
/usr/local/diablo-jdk1.6.0/bin/java -Xmx512m -jar JDownloade

...how can the size of the resident memory of pid 6913 be  512 megabytes?


this is wth a very recent HEAD on amd64.

cheers.
alex

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: issue with limiting java's memory usage

2012-01-29 Thread Patrick Lamaiziere
Le Sun, 29 Jan 2012 19:34:11 +,
Alexander Best arun...@freebsd.org a écrit :

 hi there,

Hello,

 maybe i'm missing something obvious, but i don't quite understand the
 following top(1) output:
 
 last pid: 13875;  load averages:  0.73,  0.75,  0.68
 65 processes:  2 running, 62 sleeping, 1 waiting
 CPU 0: 19.5% user,  0.0% nice, 13.3% system,  0.0% interrupt, 67.2%
 idle CPU 1: 20.3% user,  0.0% nice,  7.8% system,  0.0% interrupt,
 71.9% idle Mem: 1365M Active, 185M Inact, 323M Wired, 69M Cache, 213M
 Buf, 32M Free Swap: 10G Total, 2494M Used, 7746M Free, 24% Inuse, 4K
 In
 
   PIDUIDTHR PRI NICE   SIZERES STATE   C   TIME   WCPU
 COMMAND 6913   1001 32  200  4252M  1312M uwait   0  18.3H
 39.06% /usr/local/diablo-jdk1.6.0/bin/java -Xmx512m -jar JDownloade
 
 ...how can the size of the resident memory of pid 6913 be  512
 megabytes?

I don't know but you can inspect the java application with the java
console (jconsole). There are several stats on memory usage.

With JDownloader (doing nothing), I see 57 MB of non heap memory
usage, and only 30 MB of heap memory.

Regards.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: issue with limiting java's memory usage

2012-01-29 Thread Alexander Best
On Sun Jan 29 12, Patrick Lamaiziere wrote:
 Le Sun, 29 Jan 2012 19:34:11 +,
 Alexander Best arun...@freebsd.org a écrit :
 
  hi there,
 
 Hello,
 
  maybe i'm missing something obvious, but i don't quite understand the
  following top(1) output:
  
  last pid: 13875;  load averages:  0.73,  0.75,  0.68
  65 processes:  2 running, 62 sleeping, 1 waiting
  CPU 0: 19.5% user,  0.0% nice, 13.3% system,  0.0% interrupt, 67.2%
  idle CPU 1: 20.3% user,  0.0% nice,  7.8% system,  0.0% interrupt,
  71.9% idle Mem: 1365M Active, 185M Inact, 323M Wired, 69M Cache, 213M
  Buf, 32M Free Swap: 10G Total, 2494M Used, 7746M Free, 24% Inuse, 4K
  In
  
PIDUIDTHR PRI NICE   SIZERES STATE   C   TIME   WCPU
  COMMAND 6913   1001 32  200  4252M  1312M uwait   0  18.3H
  39.06% /usr/local/diablo-jdk1.6.0/bin/java -Xmx512m -jar JDownloade
  
  ...how can the size of the resident memory of pid 6913 be  512
  megabytes?
 
 I don't know but you can inspect the java application with the java
 console (jconsole). There are several stats on memory usage.

jconsole doesn't seem to work for me. all i get is a blank white X window. :(

cheers.
alex

 
 With JDownloader (doing nothing), I see 57 MB of non heap memory
 usage, and only 30 MB of heap memory.
 
 Regards.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Jon Schipp
Is there a program to check physical memory usage in FreeBSD(using 8.2
RELEASE)?
In vain of 'free' in Linux.

I know you can check the values with sysctl, I was just checking if anyone
has a cleaner option.
I was always curious.

Thanks
Jon
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Edward
On 11/3/11 9:18 PM, Jon Schipp wrote:
 Is there a program to check physical memory usage in FreeBSD(using 8.2
 RELEASE)?

Hi Jon,

Check out the port /usr/ports/sysutils/sysinfo .

HTH
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Jon Schipp
On Thu, Nov 3, 2011 at 9:25 AM, Rares Aioanei bsdlis...@gmail.com wrote:

 On 11/03/2011 03:18 PM, Jon Schipp wrote:

 Is there a program to check physical memory usage in FreeBSD(using 8.2
 RELEASE)?
 In vain of 'free' in Linux.

 I know you can check the values with sysctl, I was just checking if anyone
 has a cleaner option.
 I was always curious.

 Thanks
 Jon
 __**_
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/**mailman/listinfo/freebsd-**questionshttp://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-**
 unsubscr...@freebsd.org freebsd-questions-unsubscr...@freebsd.org

  top?


Crap, I forgot mention that it needs to be non-interactive, it will be for
e-mail alerts.

So that rules out top as for as I know.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Mike Jeays
On Thu, 3 Nov 2011 10:06:19 -0400
Jon Schipp jonsch...@gmail.com wrote:

 On Thu, Nov 3, 2011 at 9:25 AM, Rares Aioanei bsdlis...@gmail.com wrote:
 
  On 11/03/2011 03:18 PM, Jon Schipp wrote:
 
  Is there a program to check physical memory usage in FreeBSD(using 8.2
  RELEASE)?
  In vain of 'free' in Linux.
 
  I know you can check the values with sysctl, I was just checking if anyone
  has a cleaner option.
  I was always curious.
 
  Thanks
  Jon
  __**_
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/**mailman/listinfo/freebsd-**questionshttp://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to freebsd-questions-**
  unsubscr...@freebsd.org freebsd-questions-unsubscr...@freebsd.org
 
   top?
 
 
 Crap, I forgot mention that it needs to be non-interactive, it will be for
 e-mail alerts.
 
 So that rules out top as for as I know.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

top -n 1 followed by grep or awk might do what you want.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread mrkvrg
Hello Jon,

Perhaps the port sysutils/freecolor.

Cheers ...

Mark

Is there a program to check physical memory usage in FreeBSD(using 8.2
RELEASE)?
In vain of 'free' in Linux.

I know you can check the values with sysctl, I was just checking if 
anyone
has a cleaner option.
I was always curious.

Thanks
Jon
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Lowell Gilbert
Jon Schipp jonsch...@gmail.com writes:

 On Thu, Nov 3, 2011 at 9:25 AM, Rares Aioanei bsdlis...@gmail.com wrote:

 On 11/03/2011 03:18 PM, Jon Schipp wrote:

 Is there a program to check physical memory usage in FreeBSD(using 8.2
 RELEASE)?
 In vain of 'free' in Linux.

 I know you can check the values with sysctl, I was just checking if anyone
 has a cleaner option.
 I was always curious.

 Thanks
 Jon
 __**_
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/**mailman/listinfo/freebsd-**questionshttp://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-**
 unsubscr...@freebsd.org freebsd-questions-unsubscr...@freebsd.org

  top?


 Crap, I forgot mention that it needs to be non-interactive, it will be for
 e-mail alerts.

 So that rules out top as for as I know.

No, you could script it out of top(1), but I'm going to guess that
you're trying to be warned when the system is close to running out of
memory.  That is silly -- you paid for the memory; why would you *want* 
it to sit around doing nothing?

Also note that the definition of free is somewhat complicated.

Maybe if you described the actual problem you want to solve, we could
suggest a more appropriate answer.

A literal answer to your question might be: 
 top -d 1|grep '^Mem:'|cut -d ',' -f 6
assuming the format of the line of top doesn't change.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Jon Schipp
On Thu, Nov 3, 2011 at 11:35 AM, Robert Bonomi bon...@mail.r-bonomi.comwrote:

  From owner-freebsd-questi...@freebsd.org  Thu Nov  3 08:17:46 2011
  Date: Thu, 3 Nov 2011 09:18:06 -0400
  From: Jon Schipp jonsch...@gmail.com
  To: freebsd-questions@freebsd.org
  Subject: Check Memory Usage, program like 'free' in Linux
 
  Is there a program to check physical memory usage in FreeBSD(using 8.2
  RELEASE)?
  In vain of 'free' in Linux.

 Having *NO* idea what linux 'free' does, your question is hard to answer.
 
  I know you can check the values with sysctl, I was just checking if
 anyone
  has a cleaner option.
  I was always curious.

 If you're just looking for the amount of 'free' memory, the 3rd field of
 the third line of the  output of vmstat(8) has that value.


I'm under the impression that virtual memory and physical memory usage are
very different.

e.g. vmstat and top report very different memory values.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Jon Schipp
On Thu, Nov 3, 2011 at 11:55 AM, Lowell Gilbert 
freebsd-questions-lo...@be-well.ilk.org wrote:

 Jon Schipp jonsch...@gmail.com writes:

  On Thu, Nov 3, 2011 at 9:25 AM, Rares Aioanei bsdlis...@gmail.com
 wrote:
 
  On 11/03/2011 03:18 PM, Jon Schipp wrote:
 
  Is there a program to check physical memory usage in FreeBSD(using 8.2
  RELEASE)?
  In vain of 'free' in Linux.
 
  I know you can check the values with sysctl, I was just checking if
 anyone
  has a cleaner option.
  I was always curious.
 
  Thanks
  Jon
  __**_
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/**mailman/listinfo/freebsd-**questions
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to freebsd-questions-**
  unsubscr...@freebsd.org freebsd-questions-unsubscr...@freebsd.org
 
   top?
 
 
  Crap, I forgot mention that it needs to be non-interactive, it will be
 for
  e-mail alerts.
 
  So that rules out top as for as I know.

 No, you could script it out of top(1), but I'm going to guess that
 you're trying to be warned when the system is close to running out of
 memory.  That is silly -- you paid for the memory; why would you *want*
 it to sit around doing nothing?


While this isn't my intention...

I'm curious:

You wouldn't want to know when your machine has reached periods of high
memory utilization?
Occurrence/frequency information seems pretty valuable.
More importantly, at specific times, noticing patterns, use during/after
business hours
If you didn't want to use memory, it wouldn't be purchased. I don't think
keeping track of the utility of
your purchases is silly.

Also note that the definition of free is somewhat complicated.

 Maybe if you described the actual problem you want to solve, we could
 suggest a more appropriate answer.

 A literal answer to your question might be:
  top -d 1|grep '^Mem:'|cut -d ',' -f 6
 assuming the format of the line of top doesn't change.


That does the trick. I didn't think it was possible to grab data from
interactive programs without throwing in some garbage.
Should've tested.
Thanks
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Adam Vande More
On Thu, Nov 3, 2011 at 11:12 AM, Jon Schipp jonsch...@gmail.com wrote:

 I'm under the impression that virtual memory and physical memory usage are
 very different.

 e.g. vmstat and top report very different memory values.


If I assume this is an XY problem, and your true goal is find out what
memory pressure a system is under then my answer would be to track the
percent of swap used.  Free memory is a useful utility on Windows XP, not
so much on FreeBSD.

So to answer your question in another way, there is a reason free doesn't
exist on FreeBSD.  It's not very meaningful.



-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Check Memory Usage, program like 'free' in Linux

2011-11-03 Thread Lowell Gilbert
Jon Schipp jonsch...@gmail.com writes:

 You wouldn't want to know when your machine has reached periods of high
 memory utilization?

No, I want to know when my machine would perform better if it had more
memory.  Keeping memory in use when it otherwise would be free means I
get *better* performance.

 Occurrence/frequency information seems pretty valuable.
 More importantly, at specific times, noticing patterns, use during/after
 business hours

 If you didn't want to use memory, it wouldn't be purchased. I don't think
 keeping track of the utility of
 your purchases is silly.

That makes sense, but the amount of free memory does not tell you any
of what you're saying you want to track.  Please start by reading the
FAQ question titled Why does top show very little free memory even when
I have very few programs running?.

 That does the trick. I didn't think it was possible to grab data from
 interactive programs without throwing in some garbage.

Technically, top(1) isn't an interactive program at all if you send its
output to a pipe.  It still could use terminal features, but it
doesn't.  This is described within the first 25 lines of its manual.  In
fact, I notice that the '-d 1' option (that I put in my suggestion) is
redundant. 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: top memory usage question

2010-05-31 Thread Eitan Adler
On Thu, May 27, 2010 at 12:52 PM, Coert lgro...@waagmeester.co.za wrote:
 Hello all,

 Just a question, on Linux the output of top's memory usage looks like this:

 Mem:   2075424k total,  1760848k used,   314576k free,   151872k buffers
 Swap:  4192924k total,        0k used,  4192924k free,  1214052k cached


 on FreeBSD:

 Mem: 48M Active, 945M Inact, 190M Wired, 112M Buf, 804M Free
 Swap: 4063M Total, 4063M Free


 I have looked at the respective man pages, and googled.
 Where can I find out what Active, Inactive, and Wired mean?


The differences have to do with the way memory is managed. Active
memory is currently is RAM and is being used by a currently running
process. Inactive is in RAM but is not currently being used. Wired
means that the page is locked into ram and won't be paged out.

Look at http://en.wikipedia.org/wiki/Paging and
http://en.wikipedia.org/wiki/Virtual_memory for more info












-- 
Eitan Adler
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


top memory usage question

2010-05-27 Thread Coert

Hello all,

Just a question, on Linux the output of top's memory usage looks like this:

Mem:   2075424k total,  1760848k used,   314576k free,   151872k buffers
Swap:  4192924k total,0k used,  4192924k free,  1214052k cached


on FreeBSD:

Mem: 48M Active, 945M Inact, 190M Wired, 112M Buf, 804M Free
Swap: 4063M Total, 4063M Free


I have looked at the respective man pages, and googled.
Where can I find out what Active, Inactive, and Wired mean?


Thank you,
Coert
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: top memory usage question

2010-05-27 Thread RW
On Thu, 27 May 2010 11:52:15 +0200
Coert lgro...@waagmeester.co.za wrote:

 Hello all,
 
 Just a question, on Linux the output of top's memory usage looks like
 this:
 
 Mem:   2075424k total,  1760848k used,   314576k free,   151872k
 buffers Swap:  4192924k total,0k used,  4192924k free,
 1214052k cached
 
 
 on FreeBSD:
 
 Mem: 48M Active, 945M Inact, 190M Wired, 112M Buf, 804M Free
 Swap: 4063M Total, 4063M Free

This is missing Cache

 I have looked at the respective man pages, and googled.
 Where can I find out what Active, Inactive, and Wired mean?


Active, Inact, Cache , and Free are all part of the same VM lifecycle.
When the system need to allocate memory it comes from cache or free.

Wired memory wont be paged-out.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: API to find the memory usage of a process.

2010-03-20 Thread Pieter de Goeje
On Thursday 18 March 2010 18:28:48 Jayadev Kumar wrote:
 Hi,

 I  need to find the memory usage of a process, from inside the process.
 Is there any system call
 do this ? I was trying to find it from 'top' utility source code. I
 couldn't find the port which it is coming
 from yet.

 Thanks,
 Jayadev.

Check out getrusage(2).

- Pieter
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


API to find the memory usage of a process.

2010-03-18 Thread Jayadev Kumar
Hi,

I  need to find the memory usage of a process, from inside the process.
Is there any system call
do this ? I was trying to find it from 'top' utility source code. I couldn't
find the port which it is coming
from yet.

Thanks,
Jayadev.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: API to find the memory usage of a process.

2010-03-18 Thread J. Johnston

On 03/18/10 10:28, Jayadev Kumar wrote:

Hi,

 I  need to find the memory usage of a process, from inside the process.
Is there any system call
do this ? I was trying to find it from 'top' utility source code. I couldn't
find the port which it is coming
from yet.

Thanks,
Jayadev.


the source for top is located in /usr/src/usr.bin/top


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: API to find the memory usage of a process.

2010-03-18 Thread Charlie Kester

On Thu 18 Mar 2010 at 18:30:00 PDT J. Johnston wrote:

On 03/18/10 10:28, Jayadev Kumar wrote:

Hi,

I  need to find the memory usage of a process, from inside the process.
Is there any system call
do this ? I was trying to find it from 'top' utility source code. I couldn't
find the port which it is coming
from yet.

Thanks,
Jayadev.


the source for top is located in /usr/src/usr.bin/top


whereis -sq foo

will get you the source directory for foo, assuming you installed the
system sources, or if foo is also the name of the port.

If foo was installed by a port with some other name, you can find it
with

pkg_info -W foo

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Looking for a convenient way in C to retrieve CPU and memory usage of a process

2009-12-27 Thread Matthew Seaman

Manish Jain wrote:

I am looking for a convenient way using C to retrieve the current CPU 
and memory utilization of a process of which I have the pid. Can 
somebody please give me a hint of which system-calls/library-functions 
to use for this ? I don't want to use the system() function or grep for 
information via the /proc filesystem.


I would be grateful if you could also please mention whether the 
suggested method[s] is/are FreeBSD-specific or would be portable to 
other environments like Solaris/Linux ?


Use the source, Luke.  In this cse, probably a very good place to start is
with top(1) since it already does a lot of what you want.  Start with 
/usr/src/contrib/top/


This sort of thing generally requires reading /dev/kmem, which is very OS
dependent.  The same sort of approach will probably work on most Unix-oid
OSes, but the details will be significantly different.

Cheers,

Matthew

--
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
 Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
 Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: Looking for a convenient way in C to retrieve CPU and memory usage of a process

2009-12-27 Thread b. f.
I am looking for a convenient way using C to retrieve the current CPU
and memory utilization of a process of which I have the pid. Can
somebody please give me a hint of which system-calls/library-functions
to use for this ? I don't want to use the system() function or grep for
information via the /proc filesystem.

I would be grateful if you could also please mention whether the
suggested method[s] is/are FreeBSD-specific or would be portable to
other environments like Solaris/Linux ?


Hmm. Portable, no /proc... ?  It could be tough to do this
generically.  Why not look at unixtop, which tries to be portable?:

http://sourceforge.net/projects/unixtop/files/

I think on FreeBSD it resorts to using kvm(3).  You could just call
that directly.  Also, coming soon on FreeBSD, there will be
libprocstat, which aims at making this easier:

http://svn.freebsd.org/viewvc/base/projects/libprocstat/

stas@ is working on that.  This kind of question is best suited for
freebsd-hackers@ .

Regards,

b.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Looking for a convenient way in C to retrieve CPU and memory usage of a process

2009-12-26 Thread Manish Jain


Hello,

I am looking for a convenient way using C to retrieve the current CPU 
and memory utilization of a process of which I have the pid. Can 
somebody please give me a hint of which system-calls/library-functions 
to use for this ? I don't want to use the system() function or grep for 
information via the /proc filesystem.


I would be grateful if you could also please mention whether the 
suggested method[s] is/are FreeBSD-specific or would be portable to 
other environments like Solaris/Linux ?



Thanks for any help.

Regards  Happy New Year
Manish Jain
invalid.poin...@gmail.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-02 Thread Bill Moran
In response to Per olof Ljungmark p...@intersonic.se:

 Dan Nelson wrote:
  In the last episode (Sep 01), Bill Moran said:
  In response to Per olof Ljungmark p...@intersonic.se:
  What is a good way to find out how memory is used? Have a 6.4 box where
  memory is used by something but I fail to see what is using it - tried
  different switches to ps(1), tried the stat tools but a big chunk of
  memory does not show at all.
 
  A proper tool for analyzing memory usage live, this is a production
  box?
  I've always been able to get what I need from top.  You can do -o res to
  sort by resident memory usage, which helps.
  
  ps will sort by memory usage when given the -m flag.  Also check ipcs -a to
  see if there are any sysv shared memory segments hanging arnound.  If you
  don't see anything using the memory, where are you seeing that something
  is using it?
  
 
 ...and here is top output after I stopped Postfix, slapd and Cyrus-IMAP. 
 Still over 3G Active.

snip

You did not sort by res and there are only 40 processes showing, which
means your output is truncated and may have truncated the problematic
process.

Please use top -o res to get the output sorted by memory usage, or
don't truncate the output (former preferred).

Also, please provide the output of ipcs -a

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-02 Thread Per olof Ljungmark

Bill Moran wrote:

In response to Per olof Ljungmark p...@intersonic.se:


Dan Nelson wrote:

In the last episode (Sep 01), Bill Moran said:

In response to Per olof Ljungmark p...@intersonic.se:

What is a good way to find out how memory is used? Have a 6.4 box where
memory is used by something but I fail to see what is using it - tried
different switches to ps(1), tried the stat tools but a big chunk of
memory does not show at all.

A proper tool for analyzing memory usage live, this is a production
box?

I've always been able to get what I need from top.  You can do -o res to
sort by resident memory usage, which helps.

ps will sort by memory usage when given the -m flag.  Also check ipcs -a to
see if there are any sysv shared memory segments hanging arnound.  If you
don't see anything using the memory, where are you seeing that something
is using it?

...and here is top output after I stopped Postfix, slapd and Cyrus-IMAP. 
Still over 3G Active.


snip

You did not sort by res and there are only 40 processes showing, which
means your output is truncated and may have truncated the problematic
process.

Please use top -o res to get the output sorted by memory usage, or
don't truncate the output (former preferred).

Also, please provide the output of ipcs -a



There was no more processes...

ipcs -a
Message Queues:
T   ID  KEY MODEOWNERGROUPCREATOR 
CGROUP CBYTES QNUM   QBYTES 
   LSPIDLRPID STIMERTIMECTIME


Shared Memory:
T   ID  KEY MODEOWNERGROUPCREATOR 
CGROUP NATTCHSEGSZ CPID LPID ATIME 
DTIMECTIME


Semaphores:
T   ID  KEY MODEOWNERGROUPCREATOR 
CGROUP  NSEMS OTIMECTIME

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-02 Thread Bill Moran
In response to Per olof Ljungmark p...@intersonic.se:

 Bill Moran wrote:
  In response to Per olof Ljungmark p...@intersonic.se:
  
  Dan Nelson wrote:
  In the last episode (Sep 01), Bill Moran said:
  In response to Per olof Ljungmark p...@intersonic.se:
  What is a good way to find out how memory is used? Have a 6.4 box where
  memory is used by something but I fail to see what is using it - tried
  different switches to ps(1), tried the stat tools but a big chunk of
  memory does not show at all.
 
  A proper tool for analyzing memory usage live, this is a production
  box?
  I've always been able to get what I need from top.  You can do -o res to
  sort by resident memory usage, which helps.
  ps will sort by memory usage when given the -m flag.  Also check ipcs -a 
  to
  see if there are any sysv shared memory segments hanging arnound.  If you
  don't see anything using the memory, where are you seeing that something
  is using it?
 
  ...and here is top output after I stopped Postfix, slapd and Cyrus-IMAP. 
  Still over 3G Active.
  
  snip
  
  You did not sort by res and there are only 40 processes showing, which
  means your output is truncated and may have truncated the problematic
  process.
  
  Please use top -o res to get the output sorted by memory usage, or
  don't truncate the output (former preferred).
  
  Also, please provide the output of ipcs -a
 
 There was no more processes...

From your top output:
 45 processes:  1 running, 44 sleeping

There were 40 processes listed, so there were 5 not shown.

 ipcs -a

OK, this verifies that nothing is tied up in shared memory.

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-02 Thread Mel Flynn
On Tuesday 01 September 2009 23:19:23 Michael David Crawford wrote:
 Per olof Ljungmark wrote:
  Well, my problem is that if I add up all I *can* see in top or ps it
  never gets near the by now 3G plus memory shown as Active. Maybe one
  gig is accounted for,

 I'm not that familiar with FreeBSD yet, but the kernel uses memory which
 might not be charged against any process.

 For example, to map some virtual memory requires memory to store the
 mappings in.

 Open files have kernel structures, as do filesystems.

 If top or ps were only to show userspace memory allocations, then you're
 right, a lot of memory would be unaccounted for.

It doesn't for the Active to Free states. For individual processes, everything 
is shown that the process allocates. So for a file descriptor, an int would be 
allocated, where the kernel holds the real info.

This is one cause for filled Active memory: a process polling multiple file 
descriptors, like a File Alteration Monitor under current desktops.

The other, as Dan Nelson described, is file cache. If you want to be sure it's 
this, then reboot the machine and run:
/etc/periodic/security/100.chksetuid

You should see memory usage going up. If this causes a performance problem 
(i.e. You sometimes are subject to heavily increasing loads on a mailserver, 
that causes a lot of forks and file cache memory isn't unloaded fast enough), 
then you should either disable the security check or properly seperate data 
from binaries using partitions and mount data partitions with nosuid/noexec, 
so that these are omitted from the daily checks.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-02 Thread Per olof Ljungmark

Mel Flynn wrote:

On Tuesday 01 September 2009 23:19:23 Michael David Crawford wrote:

Per olof Ljungmark wrote:

Well, my problem is that if I add up all I *can* see in top or ps it
never gets near the by now 3G plus memory shown as Active. Maybe one
gig is accounted for,

I'm not that familiar with FreeBSD yet, but the kernel uses memory which
might not be charged against any process.

For example, to map some virtual memory requires memory to store the
mappings in.

Open files have kernel structures, as do filesystems.

If top or ps were only to show userspace memory allocations, then you're
right, a lot of memory would be unaccounted for.


It doesn't for the Active to Free states. For individual processes, everything 
is shown that the process allocates. So for a file descriptor, an int would be 
allocated, where the kernel holds the real info.


This is one cause for filled Active memory: a process polling multiple file 
descriptors, like a File Alteration Monitor under current desktops.


The other, as Dan Nelson described, is file cache. If you want to be sure it's 
this, then reboot the machine and run:

/etc/periodic/security/100.chksetuid

You should see memory usage going up. If this causes a performance problem 
(i.e. You sometimes are subject to heavily increasing loads on a mailserver, 
that causes a lot of forks and file cache memory isn't unloaded fast enough), 
then you should either disable the security check or properly seperate data 
from binaries using partitions and mount data partitions with nosuid/noexec, 
so that these are omitted from the daily checks.


Thank you all for the informative answers, helped a lot to understand 
better what is going on.


I cannot run 100.chksetuid on a production server but I will definitely 
do it on the testing one.


Cheers,
--
per
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


memory usage displsy

2009-09-01 Thread Per olof Ljungmark

Hello,

What is a good way to find out how memory is used? Have a 6.4 box where 
memory is used by something but I fail to see what is using it - tried 
different switches to ps(1), tried the stat tools but a big chunk of 
memory does not show at all.


A proper tool for analyzing memory usage live, this is a production box?

Thanks,
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Bill Moran
In response to Per olof Ljungmark p...@intersonic.se:
 
 What is a good way to find out how memory is used? Have a 6.4 box where 
 memory is used by something but I fail to see what is using it - tried 
 different switches to ps(1), tried the stat tools but a big chunk of 
 memory does not show at all.
 
 A proper tool for analyzing memory usage live, this is a production box?

I've always been able to get what I need from top.  You can do -o res to
sort by resident memory usage, which helps.

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Dan Nelson
In the last episode (Sep 01), Bill Moran said:
 In response to Per olof Ljungmark p...@intersonic.se:
  What is a good way to find out how memory is used? Have a 6.4 box where
  memory is used by something but I fail to see what is using it - tried
  different switches to ps(1), tried the stat tools but a big chunk of
  memory does not show at all.
  
  A proper tool for analyzing memory usage live, this is a production
  box?
 
 I've always been able to get what I need from top.  You can do -o res to
 sort by resident memory usage, which helps.

ps will sort by memory usage when given the -m flag.  Also check ipcs -a to
see if there are any sysv shared memory segments hanging arnound.  If you
don't see anything using the memory, where are you seeing that something
is using it?

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Michael David Crawford

Per olof Ljungmark wrote:
Well, my problem is that if I add up all I *can* see in top or ps it 
never gets near the by now 3G plus memory shown as Active. Maybe one 
gig is accounted for,


I'm not that familiar with FreeBSD yet, but the kernel uses memory which 
might not be charged against any process.


For example, to map some virtual memory requires memory to store the 
mappings in.


Open files have kernel structures, as do filesystems.

If top or ps were only to show userspace memory allocations, then you're 
right, a lot of memory would be unaccounted for.


Mike
--
Michael David Crawford
m...@prgmr.com

   prgmr.com - We Don't Assume You Are Stupid.

  Xen-Powered Virtual Private Servers: http://prgmr.com/xen
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Per olof Ljungmark

Bill Moran wrote:

In response to Per olof Ljungmark p...@intersonic.se:
What is a good way to find out how memory is used? Have a 6.4 box where 
memory is used by something but I fail to see what is using it - tried 
different switches to ps(1), tried the stat tools but a big chunk of 
memory does not show at all.


A proper tool for analyzing memory usage live, this is a production box?


I've always been able to get what I need from top.  You can do -o res to
sort by resident memory usage, which helps.



Well, my problem is that if I add up all I *can* see in top or ps it 
never gets near the by now 3G plus memory shown as Active. Maybe one 
gig is accounted for,

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Per olof Ljungmark

Dan Nelson wrote:

In the last episode (Sep 01), Bill Moran said:

In response to Per olof Ljungmark p...@intersonic.se:

What is a good way to find out how memory is used? Have a 6.4 box where
memory is used by something but I fail to see what is using it - tried
different switches to ps(1), tried the stat tools but a big chunk of
memory does not show at all.

A proper tool for analyzing memory usage live, this is a production
box?

I've always been able to get what I need from top.  You can do -o res to
sort by resident memory usage, which helps.


ps will sort by memory usage when given the -m flag.  Also check ipcs -a to
see if there are any sysv shared memory segments hanging arnound.  If you
don't see anything using the memory, where are you seeing that something
is using it?


What I see is a slapd process using about 150M, then around a hundred 
imap processes 5-10M each. If the server is restarted, 70-80% will be 
free, now, after three months we're at 11% free loosing about 20% per month.


The exact sum VSZ right now as shown by ps is 1073632k but top says

Mem: 3111M Active, 311M Inact, 230M Wired, 144M Cache, 112M Buf, 27M Free

Clearly something is grabbing memory and not releasing it.

Stopping and starting various programs makes very little difference.
No SYSV mem at all.


Thanks,
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Per olof Ljungmark

Dan Nelson wrote:

In the last episode (Sep 01), Bill Moran said:

In response to Per olof Ljungmark p...@intersonic.se:

What is a good way to find out how memory is used? Have a 6.4 box where
memory is used by something but I fail to see what is using it - tried
different switches to ps(1), tried the stat tools but a big chunk of
memory does not show at all.

A proper tool for analyzing memory usage live, this is a production
box?

I've always been able to get what I need from top.  You can do -o res to
sort by resident memory usage, which helps.


ps will sort by memory usage when given the -m flag.  Also check ipcs -a to
see if there are any sysv shared memory segments hanging arnound.  If you
don't see anything using the memory, where are you seeing that something
is using it?



...and here is top output after I stopped Postfix, slapd and Cyrus-IMAP. 
Still over 3G Active.


last pid: 10278;  load averages:  0.03,  0.02,  0.00 


 up 93+02:50:16  01:57:35
45 processes:  1 running, 44 sleeping
CPU:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
Mem: 3057M Active, 312M Inact, 228M Wired, 144M Cache, 112M Buf, 81M Free
Swap: 4096M Total, 80K Used, 4096M Free

  PID USERNAME  THR PRI NICE   SIZERES STATETIME   WCPU COMMAND
  647 root4  200  3372K  1508K kserel 110:35  0.00% apcupsd
  831 root3  200  5008K  1920K kserel  58:48  0.00% bacula-fd
  480 root1  960  1416K   932K select  25:23  0.00% syslogd
  596 bind1   40  6400K  5160K kqread  23:05  0.00% named
  709 root1  960  2780K  1484K select   4:26  0.00% ntpd
  661 root1   40  3372K  1972K accept   0:53  0.00% saslauthd
  660 root1  200  3372K  1972K lockf0:53  0.00% saslauthd
  662 root1  200  3372K  1972K lockf0:53  0.00% saslauthd
  659 root1  200  3372K  1972K lockf0:53  0.00% saslauthd
  657 root1  200  3372K  1972K lockf0:52  0.00% saslauthd
  913 root1   80  1412K   900K nanslp   0:22  0.00% cron
91648 peo 1  960 11372K  7572K select   0:04  0.00% sshd
 3419 nagios  1  960  1380K   960K select   0:01  0.00% nrpe2
91656 root1  200  3880K  1952K pause0:00  0.00% csh
10243 root1  960  2516K  1604K RUN  0:00  0.00% top
95511 root1   50  4120K  2156K ttyin0:00  0.00% csh
95504 peo 1  960  6296K  2544K select   0:00  0.00% sshd
95502 root1   40  6300K  2540K sbwait   0:00  0.00% sshd
91646 root1   40  6300K  2476K sbwait   0:00  0.00% sshd
10223 root1   40  6300K  2660K sbwait   0:00  0.00% sshd
10232 root1   50  3880K  2044K ttyin0:00  0.00% csh
91650 peo 1  200  3836K  1848K pause0:00  0.00% csh
95506 peo 1  200  3940K  1916K pause0:00  0.00% csh
10227 peo 1  200  3836K  1976K pause0:00  0.00% csh
  906 root1  960  3552K  2016K select   0:00  0.00% sshd
10225 peo 1  960  6296K  2664K select   0:00  0.00% sshd
  429 root1  960   528K   284K select   0:00  0.00% devd
91654 peo 1   80  1804K  1112K wait 0:00  0.00% su
95510 peo 1   80  1804K  1168K wait 0:00  0.00% su
10231 peo 1   80  1804K  1244K wait 0:00  0.00% su
  961 root1   50  1352K   784K ttyin0:00  0.00% getty
  962 root1   50  1352K   784K ttyin0:00  0.00% getty
  968 root1   50  1352K   784K ttyin0:00  0.00% getty
  964 root1   50  1352K   784K ttyin0:00  0.00% getty
  966 root1   50  1352K   784K ttyin0:00  0.00% getty
  963 root1   50  1352K   784K ttyin0:00  0.00% getty
  965 root1   50  1352K   784K ttyin0:00  0.00% getty
  967 root1   50  1352K   784K ttyin0:00  0.00% getty
  943 root1 1110  1444K   840K select   0:00  0.00% inetd
  138 root1  200  1260K   636K pause0:00  0.00% adjkerntz

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: memory usage displsy

2009-09-01 Thread Dan Nelson
In the last episode (Sep 02), Per olof Ljungmark said:
 Dan Nelson wrote:
  In the last episode (Sep 01), Bill Moran said:
  In response to Per olof Ljungmark p...@intersonic.se:
  What is a good way to find out how memory is used? Have a 6.4 box
  where memory is used by something but I fail to see what is using it -
  tried different switches to ps(1), tried the stat tools but a big
  chunk of memory does not show at all.
 
  A proper tool for analyzing memory usage live, this is a production
  box?
 
  I've always been able to get what I need from top.  You can do -o res to
  sort by resident memory usage, which helps.
  
  ps will sort by memory usage when given the -m flag.  Also check ipcs -a
  to see if there are any sysv shared memory segments hanging arnound.  If
  you don't see anything using the memory, where are you seeing that
  something is using it?
 
 What I see is a slapd process using about 150M, then around a hundred imap
 processes 5-10M each.  If the server is restarted, 70-80% will be free,
 now, after three months we're at 11% free loosing about 20% per month.
 
 The exact sum VSZ right now as shown by ps is 1073632k but top says
 
 Mem: 3111M Active, 311M Inact, 230M Wired, 144M Cache, 112M Buf, 27M Free
 
 Clearly something is grabbing memory and not releasing it.

Disk cache, most likely.  I would expect Free memory as reported by top to
drop down to under 100MB a few hours after a system is rebooted.  The
difference between Active-Inact-Cache-Buf is more an indication of how
long ago a particular page has been touched (and how much work it is to map
the page back into a processes memory space), and doesn't really say what
the block is being used for.  If you are not actively swapping, there is no
need for panic.  Even a couple hundred MB of used swap is fine, as long as
you're not constantly having to pull it back into memory.

http://www.freebsd.org/doc/en/books/arch-handbook/vm.html has a good rundown
of how the VM system works.

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Memory Usage

2009-01-03 Thread Patrick Lamaizière
Le Fri, 2 Jan 2009 10:47:32 -0500,
Grant Peel gp...@thenetnow.com a écrit :

 Hi all,
 
 Does anyone have scripts they may be willing to share the parses any
 FreeBSD utility (top, w, etc) suitable for using the output to use
 mrtg to show memory and disk usage?

Mrtg needs a script that returns four lines :
- the first value
- the second value (return 0 if only one value is used)
- the Uptime
- The legend 

By example a little script to return the number of processus using ps
-xa

net:/1local/libexec/mrtg# ./pn2mrtg
193
0
12 days, 10:20
net

see http://user.lamaiziere.net/patrick/mrtg.tar.gz as examples.
(The scripts are quite uggly...)

http://lamaiziere.net/private/stat/net/ for the result

OTH, regards.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Memory Usage

2009-01-03 Thread Roger Olofsson



Grant Peel skrev:

Hi all,

Does anyone have scripts they may be willing to share the parses any FreeBSD 
utility (top, w, etc) suitable for using the output to use mrtg to show memory 
and disk usage?

-Grant
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org





No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.10.2/1871 - Release Date: 2009-01-01 17:01




I used to use mrtg but ever since Cacti came along I've been using that 
instead. Cacti is excellent. It's in ports.


/R

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Memory Usage

2009-01-02 Thread Grant Peel
Hi all,

Does anyone have scripts they may be willing to share the parses any FreeBSD 
utility (top, w, etc) suitable for using the output to use mrtg to show memory 
and disk usage?

-Grant
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Memory Usage

2009-01-02 Thread Matthew Seaman

Grant Peel wrote:


Does anyone have scripts they may be willing to share the parses any
FreeBSD utility (top, w, etc) suitable for using the output to use
mrtg to show memory and disk usage?


net-mgmt/net-snmpd ?  Or even, perhaps the base system's bsnmpd (although
I'm not sure if this has support for all the OIDs you'ld need to query yet)?

I don't know about mrtg, but snmpd+cacti lets me graph the sort of
parameters you're interested in pretty simply.  I believe mrtg normally
does snmp queries to get interface stats -- it shouldn't be too hard to
persuade it to make the equivalent queries to get disk or memory usage
stats.

Cheers,

Matthew

--
Dr Matthew J Seaman MA, D.Phil.   7 Priory Courtyard
 Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
 Kent, CT11 9PW



signature.asc
Description: OpenPGP digital signature


Re: Bash script to find out the summary of user memory usage [not working]

2007-12-17 Thread Patrick Dung
I have correction with the script but still doesn't work:

#!/usr/local/bin/bash
for user in `ps -A -o user | sort | uniq | tail +2`
 do
echo user: $user

   ps aux -U $user | tail +2 | while read line
   do

mem=`echo $line | awk {'print $4'}`
echo mem: $mem
TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
%.2f\n,x+y}'`
echo summem: $TMPSUMMEM
   done
echo finalsummem: $SUMMEM
export SUMMEM=$TMPSUMMEM
 done

echo finalsummem: $SUMMEM

 #!/usr/local/bin/bash
 
 for user in `ps -A -o user | sort | uniq | tail +2`
  do
 echo user: $user
 
ps aux -U $user | tail +2 | while read line
do
 
 mem=`echo $line | awk {'print $4'}`
 echo mem: $mem
 TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
 %.2f\n,x+y}'`
 echo summem: $TMPSUMMEM
done
 echo finalsummem: $TMPSUMMEM


--- Patrick Dung [EMAIL PROTECTED] wrote:

 Hello, any idea about why below script is not working?
 The final sum is empty..
 
 #!/usr/local/bin/bash
 
 for user in `ps -A -o user | sort | uniq | tail +2`
  do
 echo user: $user
 
ps aux -U $user | tail +2 | while read line
do
 
 mem=`echo $line | awk {'print $4'}`
 echo mem: $mem
 TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
 %.2f\n,x+y}'`
 echo summem: $TMPSUMMEM
done
 echo finalsummem: $SUMMEM
  [EMAIL PROTECTED]
 
 
  


 Looking for last minute shopping deals?  
 Find them fast with Yahoo! Search. 

http://tools.search.yahoo.com/newsearch/category.php?category=shopping
 



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Bash script to find out the summary of user memory usage [not working]

2007-12-17 Thread Giorgos Keramidas
On 2007-12-17 06:00, Patrick Dung [EMAIL PROTECTED] wrote:
 I have correction with the script but still doesn't work:

 #!/usr/local/bin/bash
 for user in `ps -A -o user | sort | uniq | tail +2`
  do
 echo user: $user

ps aux -U $user | tail +2 | while read line
do

 mem=`echo $line | awk {'print $4'}`
 echo mem: $mem
 TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
 %.2f\n,x+y}'`
 echo summem: $TMPSUMMEM
done
 echo finalsummem: $SUMMEM
 export SUMMEM=$TMPSUMMEM
  done

 echo finalsummem: $SUMMEM

There are *many* race conditions in that script.  For example, there's
no guarantee that once you get a snapshot of the ps -A -o user output,
then the same users will be listed in the loop you are running for each
username.

The script is also a bit 'sub-optimal' because it calls ps(1) and parses
its output many times (at least as many times as there are users).  A
much better way to `design' something like this would be to keep a hash
of the usernames, and keep incrementing the hash entry for each user as
you hit ps(1) output lines.

I'm not going to even bother writing a script to use a hash in bash(1),
because there are much better languages to work with hashes,
dictionaries or even simple arrays.

Here's for example a Python script which does what I described:

 1  #!/usr/bin/env python
 2
 3  import os
 4  import re
 5  import sys
 6
 7  try:
 8  input = os.popen('ps xauwww', 'r')
 9  except:
10  print Cannot open pipe for ps(1) output
11  sys.exit(1)
12
13  # Start with an empty dictionary.
14  stats = {}
15
16  # Regexp to strip the ps(1) output header.
17  header = re.compile('USER')
18
19  for line in input.readlines():
20  if header.match(line):
21  continue
22  fields = line.split()
23  if not fields or len(fields)  4:
24  continue
25
26  (username, mem) = (fields[0], float(fields[3]))
27  value = None
28  try:
29  value = stats[username]
30  except KeyError:
31  pass
32
33  if not value:
34  stats[username] = 0.0
35  stats[username] += mem
36
37  # Print all the stats we have collected so far.
38  keys = stats.keys()
39  if len(keys)  0:
40  total = 0.0
41  print %-15s %5s % ('USERNAME', 'MEM%')
42  for k in stats.keys():
43  print %-15s %5.2f % (k, stats[k])
44  total += stats[k]
45  # Finally print a grand total of all users.
46  print %-15s %5.2f % ('TOTAL', total)

It's not the shortest Python script one could write to do what you
describe, but I've gone for readability rather than speed or
conciseness.

Running this script should produce:

$ ./foo.py
USERNAME MEM%
_pflogd  0.10
daemon   0.00
bind 1.10
_dhcp0.10
keramida38.60
smmsp0.10
root10.10
build0.00
TOTAL   50.10
$

PS: Yes, you could probably do the same in bash, with sed, awk and a bit
of superglue, but I prefer Perl and/or Python for anything which
involves something a bit more involved than simple string substitution
these days...

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Bash script to find out the summary of user memory usage [not working]

2007-12-14 Thread Patrick Dung
Hello, any idea about why below script is not working?
The final sum is empty..

#!/usr/local/bin/bash

for user in `ps -A -o user | sort | uniq | tail +2`
 do
echo user: $user

   ps aux -U $user | tail +2 | while read line
   do

mem=`echo $line | awk {'print $4'}`
echo mem: $mem
TMPSUMMEM=`awk -v x=$mem -v y=$TMPSUMMEM 'BEGIN{printf
%.2f\n,x+y}'`
echo summem: $TMPSUMMEM
   done
echo finalsummem: $SUMMEM
 [EMAIL PROTECTED]


  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Understanding top and memory usage

2006-08-02 Thread Philip Radford

Hi All,

This is a question which probably applies to all unix based OS as well as 
FreeBSD.


When using the top command I get the following in regards to memory usage.

Mem: 223M Active, 970M Inact, 175M Wired, 50M Cache, 112M Buf, 73M Free
Swap: 3029M Total, 12K Used, 3029M Free

Can someone advise me which figure relates to actual physical memory which 
is available. I can't work out if it is the 970M Inact or the 73M Free (i.e. 
the last figure).


Any advise greatfully received.

Thanks

Regards
Phil.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Understanding top and memory usage

2006-08-02 Thread Chuck Swiger

Philip Radford wrote:
[ ... ]

When using the top command I get the following in regards to memory usage.

Mem: 223M Active, 970M Inact, 175M Wired, 50M Cache, 112M Buf, 73M Free
Swap: 3029M Total, 12K Used, 3029M Free

Can someone advise me which figure relates to actual physical memory 
which is available. I can't work out if it is the 970M Inact or the 73M 
Free (i.e. the last figure).


The 73MB free is the amount of completely unused physical RAM available, but 
the system can use memory from the 970MB of inactive if needed to run new 
programs, otherwise that serves as a cache of already-accessed process and 
file data.


--
-Chuck
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-23 Thread Vinicius Vianna
From what I read you should only change kern.maxdsiz, changing 
kern.dfldsiz makes every process allocating this amount of memory by 
default, thats bad.


Something like:

kern.maxdsiz=1395864371 # 1.3GB
#kern.dfldsiz=1395864371 # 1.3GB
#kern.maxssiz=134217728 # 128MB

would do the trick for you, check limits also and see what the init 
scripts may be limiting on this process.


HTH,
DS

Thaddeus Quintin wrote:
I'm working on a FreeBSD 6.1 machine and setting up MySQL 5.0 with 
some InnoDB tables.


The machine has 2GB of RAM and will primarily be used as a database 
machine and will also be serving files over NFS (not high volume).


The issue that I'm having is that when I start up MySQL I get a couple 
Out of Memory errors before it actually starts up.  Looks like this-


060719 11:55:35  InnoDB: Started; log sequence number 0 43656
/usr/local/libexec/mysqld: Out of memory (Needed 950109184 bytes)
/usr/local/libexec/mysqld: Out of memory (Needed 712581120 bytes)
060719 11:55:35 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.0.22-log'  socket: '/tmp/mysql.sock'  port: 3306

If I reduce or increase the innodb_buffer_pool_size variable for MySQL 
I can eliminate or increase the number of errors.  This set of errors 
was with innodb_buffer_pool_size set to 600M


This is what top currently shows for MySQL-
  PID USERNAME  THR PRI NICE   SIZERES STATE  C   TIME   WCPU COMMAND
  871 mysql   8  200  1196M   159M kserel 0   0:01  0.00% mysqld

I tweaked /boot/loader.conf to allow larger data size for processes 
already (rebooted after changes)-

kern.maxdsiz=1395864371 # 1.3GB
kern.dfldsiz=1395864371 # 1.3GB
kern.maxssiz=134217728 # 128MB

If there's an out of memory error, how come MySQL starts up?  Is this 
something to be concerned about?  What else should I be checking to 
figure this out?


Thanks-
Thaddeus
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
[EMAIL PROTECTED]


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Memory usage for MySQL

2006-07-19 Thread Thaddeus Quintin
I'm working on a FreeBSD 6.1 machine and setting up MySQL 5.0 with  
some InnoDB tables.


The machine has 2GB of RAM and will primarily be used as a database  
machine and will also be serving files over NFS (not high volume).


The issue that I'm having is that when I start up MySQL I get a  
couple Out of Memory errors before it actually starts up.  Looks  
like this-


060719 11:55:35  InnoDB: Started; log sequence number 0 43656
/usr/local/libexec/mysqld: Out of memory (Needed 950109184 bytes)
/usr/local/libexec/mysqld: Out of memory (Needed 712581120 bytes)
060719 11:55:35 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.0.22-log'  socket: '/tmp/mysql.sock'  port: 3306

If I reduce or increase the innodb_buffer_pool_size variable for  
MySQL I can eliminate or increase the number of errors.  This set of  
errors was with innodb_buffer_pool_size set to 600M


This is what top currently shows for MySQL-
  PID USERNAME  THR PRI NICE   SIZERES STATE  C   TIME   WCPU  
COMMAND
  871 mysql   8  200  1196M   159M kserel 0   0:01  0.00%  
mysqld


I tweaked /boot/loader.conf to allow larger data size for processes  
already (rebooted after changes)-

kern.maxdsiz=1395864371 # 1.3GB
kern.dfldsiz=1395864371 # 1.3GB
kern.maxssiz=134217728 # 128MB

If there's an out of memory error, how come MySQL starts up?  Is this  
something to be concerned about?  What else should I be checking to  
figure this out?


Thanks-
Thaddeus
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-19 Thread Charles Swiger

On Jul 19, 2006, at 1:14 PM, Thaddeus Quintin wrote:
The issue that I'm having is that when I start up MySQL I get a  
couple Out of Memory errors before it actually starts up.  Looks  
like this-


060719 11:55:35  InnoDB: Started; log sequence number 0 43656
/usr/local/libexec/mysqld: Out of memory (Needed 950109184 bytes)
/usr/local/libexec/mysqld: Out of memory (Needed 712581120 bytes)
060719 11:55:35 [Note] /usr/local/libexec/mysqld: ready for  
connections.

Version: '5.0.22-log'  socket: '/tmp/mysql.sock'  port: 3306


FreeBSD defaults to having a 512MB maximum process datasize.  Add  
something like:


kern.dfldsiz=1G

...to /boot/loader.conf.

--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-19 Thread Thaddeus Quintin

On Jul 19, 2006, at 1:38 PM, Charles Swiger wrote:
FreeBSD defaults to having a 512MB maximum process datasize.  Add  
something like:


kern.dfldsiz=1G

...to /boot/loader.conf.


I already took care of that, it was in my first email-
I tweaked /boot/loader.conf to allow larger data size for  
processes already (rebooted after changes)-

kern.maxdsiz=1395864371 # 1.3GB
kern.dfldsiz=1395864371 # 1.3GB
kern.maxssiz=134217728 # 128MB


From what I read, that should do it, but I still get those start up  
errors before MySQL decides to run.  Maybe it has something to do  
with how quickly MySQL is asking for memory?


Thaddeus
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-19 Thread Charles Swiger

On Jul 19, 2006, at 2:31 PM, Thaddeus Quintin wrote:

I already took care of that, it was in my first email-
I tweaked /boot/loader.conf to allow larger data size for  
processes already (rebooted after changes)-

kern.maxdsiz=1395864371 # 1.3GB
kern.dfldsiz=1395864371 # 1.3GB
kern.maxssiz=134217728 # 128MB


From what I read, that should do it, but I still get those start up  
errors before MySQL decides to run.  Maybe it has something to do  
with how quickly MySQL is asking for memory?


Or maybe it's trying to ask for a big shared memory segment...?

--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-19 Thread Thaddeus Quintin

On Jul 19, 2006, at 2:37 PM, Charles Swiger wrote:

On Jul 19, 2006, at 2:31 PM, Thaddeus Quintin wrote:

I already took care of that, it was in my first email-
I tweaked /boot/loader.conf to allow larger data size for  
processes already (rebooted after changes)-

kern.maxdsiz=1395864371 # 1.3GB
kern.dfldsiz=1395864371 # 1.3GB
kern.maxssiz=134217728 # 128MB


From what I read, that should do it, but I still get those start  
up errors before MySQL decides to run.  Maybe it has something to  
do with how quickly MySQL is asking for memory?


Or maybe it's trying to ask for a big shared memory segment...?
Your guess is as good as mine.  Are there tools or anything else I  
can use to try and figure this out?


Thaddeus
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Memory usage for MySQL

2006-07-19 Thread Charles Swiger

On Jul 19, 2006, at 2:51 PM, Thaddeus Quintin wrote:

Or maybe it's trying to ask for a big shared memory segment...?
Your guess is as good as mine.  Are there tools or anything else I  
can use to try and figure this out?


MySQL probably has some documentation which would help, although if  
you wait a bit, perhaps Greg Lehey or someone more familiar with MySQL 
+FreeBSD will chime in... :-)


--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


memory usage

2006-05-07 Thread Jonathan Horne
i have a server that has 2GB ram, recently upgraded from 1GB ram.  it runs 
apache2.0 with php5, sendmail with spamass-milter, dovecot, mysql5.0, cacti, 
and a couple other small things (like snmp, my bx irc shell, etc).

when ever i look at the memory usage (via phpsysinfo, or cacti graphs), its 
nearly always showing less than 100mb of ram available.  top shows several 
perls (probably spamassassin), 8 or so httpds (typical), but that would 
probably only account for (a liberal guess) 500-600 mb of ram.

is there a good way to find out where this bottomless ram funnel leads to?  
or, should this behavior just be considered typical?

thanks,
jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: memory usage

2006-05-07 Thread Jonathan Horne
On Sunday 07 May 2006 12:09, Jonathan Horne wrote:
 i have a server that has 2GB ram, recently upgraded from 1GB ram.  it runs
 apache2.0 with php5, sendmail with spamass-milter, dovecot, mysql5.0,
 cacti, and a couple other small things (like snmp, my bx irc shell, etc).

 when ever i look at the memory usage (via phpsysinfo, or cacti graphs), its
 nearly always showing less than 100mb of ram available.  top shows several
 perls (probably spamassassin), 8 or so httpds (typical), but that would
 probably only account for (a liberal guess) 500-600 mb of ram.

 is there a good way to find out where this bottomless ram funnel leads to?
 or, should this behavior just be considered typical?

 thanks,
 jonathan

update...

i just upgraded to the new phpsysinfo rc2, and it shows more detailed 
information about what the memory usage is doing.  it shows that 1.57GB is 
being used by buffers.  what is the significance of 1.57GB of memory being 
used by 'buffers'?

thanks,
jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: memory usage

2006-05-07 Thread Jonathan Chen
On Sun, May 07, 2006 at 12:19:41PM -0500, Jonathan Horne wrote:

 i just upgraded to the new phpsysinfo rc2, and it shows more detailed 
 information about what the memory usage is doing.  it shows that 1.57GB is 
 being used by buffers.  what is the significance of 1.57GB of memory being 
 used by 'buffers'?

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#TOP-FREEMEM
-- 
Jonathan Chen [EMAIL PROTECTED]
--
The human mind ordinarily operates at only ten percent of its capacity
 -- the rest is overhead for the operating system.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: memory usage

2006-05-07 Thread Michal Mertl
Jonathan Horne wrote:
 On Sunday 07 May 2006 12:09, Jonathan Horne wrote:
  i have a server that has 2GB ram, recently upgraded from 1GB ram.  it runs
  apache2.0 with php5, sendmail with spamass-milter, dovecot, mysql5.0,
  cacti, and a couple other small things (like snmp, my bx irc shell, etc).
 
  when ever i look at the memory usage (via phpsysinfo, or cacti graphs), its
  nearly always showing less than 100mb of ram available.  top shows several
  perls (probably spamassassin), 8 or so httpds (typical), but that would
  probably only account for (a liberal guess) 500-600 mb of ram.
 
  is there a good way to find out where this bottomless ram funnel leads to?
  or, should this behavior just be considered typical?
 
  thanks,
  jonathan
 
 update...
 
 i just upgraded to the new phpsysinfo rc2, and it shows more detailed 
 information about what the memory usage is doing.  it shows that 1.57GB is 
 being used by buffers.  what is the significance of 1.57GB of memory being 
 used by 'buffers'?

I would expect a question like this is somewhere in the FAQ.

It is typical that you only see a couple of hundred kilobytes of free
memory on a (at least a little used) FreeBSD system. The system
allocates  'physical' memory as needed (as long as there is some free)
and only when there is no free memory, it starts to reuse some of the
'almost' free memory. 'Almost' free memory is mainly disk cache (your
buffers).

This is nothing to worry about. You can see there is a memory shortage
when there is some swapping during normal workload (in top there appears
kb in/out on the swap line). It is neither anything to worry about
when you have some swap space used - FreeBSD is rather aggresively
copying parts of memory to swap when it feels to. As long as it doesn't
need to use the data in the swap often it's an optimization - even disk
cache is better usage of your memory then inactive parts of your
programs' memory.

Michal

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: memory usage

2006-05-07 Thread Jonathan Horne
On Sunday 07 May 2006 19:43, Michal Mertl wrote:
 Jonathan Horne wrote:
  On Sunday 07 May 2006 12:09, Jonathan Horne wrote:
   i have a server that has 2GB ram, recently upgraded from 1GB ram.  it
   runs apache2.0 with php5, sendmail with spamass-milter, dovecot,
   mysql5.0, cacti, and a couple other small things (like snmp, my bx irc
   shell, etc).
  
   when ever i look at the memory usage (via phpsysinfo, or cacti graphs),
   its nearly always showing less than 100mb of ram available.  top shows
   several perls (probably spamassassin), 8 or so httpds (typical), but
   that would probably only account for (a liberal guess) 500-600 mb of
   ram.
  
   is there a good way to find out where this bottomless ram funnel leads
   to? or, should this behavior just be considered typical?
  
   thanks,
   jonathan
 
  update...
 
  i just upgraded to the new phpsysinfo rc2, and it shows more detailed
  information about what the memory usage is doing.  it shows that 1.57GB
  is being used by buffers.  what is the significance of 1.57GB of memory
  being used by 'buffers'?

 I would expect a question like this is somewhere in the FAQ.

 It is typical that you only see a couple of hundred kilobytes of free
 memory on a (at least a little used) FreeBSD system. The system
 allocates  'physical' memory as needed (as long as there is some free)
 and only when there is no free memory, it starts to reuse some of the
 'almost' free memory. 'Almost' free memory is mainly disk cache (your
 buffers).

 This is nothing to worry about. You can see there is a memory shortage
 when there is some swapping during normal workload (in top there appears
 kb in/out on the swap line). It is neither anything to worry about
 when you have some swap space used - FreeBSD is rather aggresively
 copying parts of memory to swap when it feels to. As long as it doesn't
 need to use the data in the swap often it's an optimization - even disk
 cache is better usage of your memory then inactive parts of your
 programs' memory.

 Michal

well, i guess my system's top confirms what you say:

Swap: 4071M Total, 4071M Free

and, i wasnt experiencing any lack in performance, i was just curious.  but i 
admit that i must be forgiven for almost doubting!

thanks again,
jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: httpd and memory usage

2005-06-14 Thread Thomas Hurst
* David Banning ([EMAIL PROTECTED]) wrote:

 I seem to have a lot of memory being eaten by httpd (part output of top);

 Any ideas to have httpd timeout sooner to preserve memory?

MaxRequestsPerChild is there to cope with leaks, it won't help if Apache
is using a lot of memory to start with though, but if you've got some
mod_php or mod_perl which leaks it can be handy.

Worker MPM uses threads and will probably share more memory than
prefork, not to mention require you to use fewer processes to handle a
given load.

Moving things like mod_php and mod_perl stuff to FastCGI avoids each
httpd having a copy of the interpreter and its various data structures
each, and segments the memory of the interpreters outside httpd so it's
easier to see what's using the memory; you'll have fewer copies running
too, since the static:dynamic request ratio isn't normally 1:1.

Commenting out unused modules in httpd.conf will save some memory.

You might also consider switching to something like lighttpd, which uses
a single process that's generally about 1/3 the size of an equivilent
httpd process.

-- 
Thomas 'Freaky' Hurst
http://hur.st/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: httpd and memory usage

2005-06-14 Thread David Banning
 Moving things like mod_php and mod_perl stuff to FastCGI avoids each
 httpd having a copy of the interpreter and its various data structures
 each, and segments the memory of the interpreters outside httpd so it's
 easier to see what's using the memory; you'll have fewer copies running
 too, since the static:dynamic request ratio isn't normally 1:1.
 
 Commenting out unused modules in httpd.conf will save some memory.
 
 You might also consider switching to something like lighttpd, which uses
 a single process that's generally about 1/3 the size of an equivilent
 httpd process.

I like these ideas. Thanks. What is the downside, if any, to using
lighttpd? Is it difficult to configure?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: httpd and memory usage

2005-06-14 Thread Thomas Hurst
* David Banning ([EMAIL PROTECTED]) wrote:

  You might also consider switching to something like lighttpd, which
  uses a single process that's generally about 1/3 the size of an
  equivilent httpd process.

 I like these ideas. Thanks. What is the downside, if any, to using
 lighttpd? Is it difficult to configure?

No, it's very easy to get working, especially with FastCGI; it's just
not quite as flexible as Apache in many respects.  This isn't always (or
even usually) a bad thing, but it depends what your needs are.

-- 
Thomas 'Freaky' Hurst
http://hur.st/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


httpd and memory usage

2005-06-11 Thread David Banning
I seem to have a lot of memory being eaten by httpd (part output of top);

62310 nobody  18   0 26792K 21516K lockf0:04  0.00%  0.00% httpd
  162 root 2   0  4328K  2244K select   0:04  0.00%  0.00% sendmail
63909 nobody  18   0 26824K 21528K lockf0:03  0.00%  0.00% httpd
62311 nobody   2   0 26740K 21432K select   0:03  0.00%  0.00% httpd
62764 nobody  18   0 26604K 21252K lockf0:03  0.00%  0.00% httpd
62800 nobody  18   0 26608K 21248K lockf0:03  0.00%  0.00% httpd
62312 nobody  18   0 26636K 21292K lockf0:03  0.00%  0.00% httpd
62309 nobody  18   0 26820K 21436K lockf0:03  0.00%  0.00% httpd
62313 nobody  18   0 26592K 21228K lockf0:03  0.00%  0.00% httpd
62381 nobody  18   0 26768K 21404K lockf0:03  0.00%  0.00% httpd
  287 root 2   0 13108K  7460K select   0:02  0.00%  0.00% httpd

I have changed the timeout in httpd.conf from 300 to 100 which does not
seem to help.

Any ideas to have httpd timeout sooner to preserve memory?

-- 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: httpd and memory usage

2005-06-11 Thread Chuck Swiger

David Banning wrote:

I seem to have a lot of memory being eaten by httpd (part output of top);

62310 nobody  18   0 26792K 21516K lockf0:04  0.00%  0.00% httpd

[ ... ]

I have changed the timeout in httpd.conf from 300 to 100 which does not
seem to help.


It wouldn't.  Apache is normally run in a prefork mode, which means it keeps 
lots of children (default is 5, plus the master) running all of the time.



Any ideas to have httpd timeout sooner to preserve memory?


If you want to reduce the memory usage, avoid using mod_perl or PHP.  httpd 
ought to shrink down to ~5MB or so per process.


--
-Chuck

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: httpd and memory usage

2005-06-11 Thread David Banning
On Sat, Jun 11, 2005 at 02:40:01PM -0400, Chuck Swiger wrote:
 David Banning wrote:
 I seem to have a lot of memory being eaten by httpd (part output of top);
 
 62310 nobody  18   0 26792K 21516K lockf0:04  0.00%  0.00% 
 httpd
 [ ... ]
 I have changed the timeout in httpd.conf from 300 to 100 which does not
 seem to help.
 
 It wouldn't.  Apache is normally run in a prefork mode, which means it 
 keeps lots of children (default is 5, plus the master) running all of the 
 time.
 
 Any ideas to have httpd timeout sooner to preserve memory?
 
 If you want to reduce the memory usage, avoid using mod_perl or PHP.  httpd 
 ought to shrink down to ~5MB or so per process.

Here is the thing though. I can apachectl restart and memory is
plentiful. So it seems like httpd -can- operate on lower memory,
albeit maybe five as you say. Surely visitors have no need for the
page, whether it be php or not. Is there a way for those memory
consuming httpd jobs to die earlier?

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


please educate me on memory usage

2004-09-24 Thread Gregor Mosheh
I was looking at my top output and was surprised to
see that the bulk of my 512 MB of memory was in use,
since the server really has fairly little running.
It's not a problem, but I was wanting some
clarification on where this memory was being used, for
my own education.

The original goal was that I had figured that a lot of
memory would be unused since so little is running, and
perhaps I could allocate some more to Postgres.
Apparently nowt, but I don't quite understand all the
intricacies of what *is* using my memory.

35 processes:  1 running, 34 sleeping
CPU states:  0.0% user,  0.0% nice,  0.0% system, 
0.0% interrupt,  100% idle
Mem: 158M Active, 207M Inact, 80M Wired, 20M Cache,
60M Buf, 33M Free
Swap: 2000M Total, 6848K Used, 1994M Free

So, 158 MB of memory in use. Does that include
anything other than process' memory, e.g. shared
memory, kernel memory, some of the fs buffer? If I add
up the VSZ column from 'ps aux' I get 110 MB.

The server's only processes of interest are MySQL,
Postgres, and Apache httpd. There are cron, sendmail,
etc. but these are all 1M usage according to both top
and ps.

MySQL has VSZ 38 MB and RSS 4 MB.

Postgres (incl stats collectors) has VSZ 25 MB and RSS
1 MB. There's also the shared memory: ipcs agrees
with my postgresql.conf settings: 2 MB of shared
memory buffers.

Apache 1.3 has 15 processes, each using 3.6 MB VSZ and
1.5 MB RSS. I was of the impression that the bulk of
this memory was shared with the parent process, no?

So where's the rest of the memory going?

The 80M Wired is interesting, since I don't know where
it's going. I presume that PG's 2 MB of shared buffers
are wired (though I saw an email today that implied
otherwise), but how could I track down the rest of it?





__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: please educate me on memory usage

2004-09-24 Thread epilogue
On Fri, 24 Sep 2004 09:59:52 -0700 (PDT)
Gregor Mosheh [EMAIL PROTECTED] wrote:

 I was looking at my top output and was surprised to
 see that the bulk of my 512 MB of memory was in use,
 since the server really has fairly little running.
 It's not a problem, but I was wanting some
 clarification on where this memory was being used, for
 my own education.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#TOP-FREEMEM

hth,
epi
 
 The original goal was that I had figured that a lot of
 memory would be unused since so little is running, and
 perhaps I could allocate some more to Postgres.
 Apparently nowt, but I don't quite understand all the
 intricacies of what *is* using my memory.
 
 35 processes:  1 running, 34 sleeping
 CPU states:  0.0% user,  0.0% nice,  0.0% system, 
 0.0% interrupt,  100% idle
 Mem: 158M Active, 207M Inact, 80M Wired, 20M Cache,
 60M Buf, 33M Free
 Swap: 2000M Total, 6848K Used, 1994M Free
 
 So, 158 MB of memory in use. Does that include
 anything other than process' memory, e.g. shared
 memory, kernel memory, some of the fs buffer? If I add
 up the VSZ column from 'ps aux' I get 110 MB.
 
 The server's only processes of interest are MySQL,
 Postgres, and Apache httpd. There are cron, sendmail,
 etc. but these are all 1M usage according to both top
 and ps.
 
 MySQL has VSZ 38 MB and RSS 4 MB.
 
 Postgres (incl stats collectors) has VSZ 25 MB and RSS
 1 MB. There's also the shared memory: ipcs agrees
 with my postgresql.conf settings: 2 MB of shared
 memory buffers.
 
 Apache 1.3 has 15 processes, each using 3.6 MB VSZ and
 1.5 MB RSS. I was of the impression that the bulk of
 this memory was shared with the parent process, no?
 
 So where's the rest of the memory going?
 
 The 80M Wired is interesting, since I don't know where
 it's going. I presume that PG's 2 MB of shared buffers
 are wired (though I saw an email today that implied
 otherwise), but how could I track down the rest of it?
 
 
 
 
   
 __
 Do you Yahoo!?
 Yahoo! Mail is new and improved - Check it out!
 http://promotions.yahoo.com/new_mail
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to
 [EMAIL PROTECTED]
 
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: please educate me on memory usage

2004-09-24 Thread Norm Vilmer
Gregor Mosheh wrote:
I was looking at my top output and was surprised to
see that the bulk of my 512 MB of memory was in use,
since the server really has fairly little running.
It's not a problem, but I was wanting some
clarification on where this memory was being used, for
my own education.
The original goal was that I had figured that a lot of
memory would be unused since so little is running, and
perhaps I could allocate some more to Postgres.
Apparently nowt, but I don't quite understand all the
intricacies of what *is* using my memory.
35 processes:  1 running, 34 sleeping
CPU states:  0.0% user,  0.0% nice,  0.0% system, 
0.0% interrupt,  100% idle
Mem: 158M Active, 207M Inact, 80M Wired, 20M Cache,
60M Buf, 33M Free
Swap: 2000M Total, 6848K Used, 1994M Free

So, 158 MB of memory in use. Does that include
anything other than process' memory, e.g. shared
memory, kernel memory, some of the fs buffer? If I add
up the VSZ column from 'ps aux' I get 110 MB.
The server's only processes of interest are MySQL,
Postgres, and Apache httpd. There are cron, sendmail,
etc. but these are all 1M usage according to both top
and ps.
MySQL has VSZ 38 MB and RSS 4 MB.
Postgres (incl stats collectors) has VSZ 25 MB and RSS
1 MB. There's also the shared memory: ipcs agrees
with my postgresql.conf settings: 2 MB of shared
memory buffers.
Apache 1.3 has 15 processes, each using 3.6 MB VSZ and
1.5 MB RSS. I was of the impression that the bulk of
this memory was shared with the parent process, no?
So where's the rest of the memory going?
The 80M Wired is interesting, since I don't know where
it's going. I presume that PG's 2 MB of shared buffers
are wired (though I saw an email today that implied
otherwise), but how could I track down the rest of it?


__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]
My guess would be MySQL, however I am no expert. My machine is running
apache, ntp, ipfw, and other typical stuff like syslog, sendmail, etc.
Mem: 11M Active, 122M Inact, 44M Wired, 28K Cache, 57 Buf, 292M Free.
I did optimize my machine using doc's I read on www.FreeBSD.org.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


memory usage question

2004-08-17 Thread Mipam
Hi,

I have a question about usage of memory.
Despite the well documented articles about it some things are still
unclear. In top we see memory devided in several items:

Active, inactive, buffered, wired and free.
The active memory is clear, it's what is in use by programs now.
Wired mem is also clear, it's for the kernel data structs.
When a program ends, the mem is put in the inactive part right?
So when the program is run 10 minutes after it can be started very 
quickly, also because the data used from the disk of that program is still 
in the cache part right? However, suppose the program isnt run in 2 hours, 
will there be a timeout in the parts which are being put in inactive and 
in cache? Suppose the timeout has occured, will the mem be added to free 
mem or? What is the difference between buffered mem and cached mem? Both 
represent data which is recently being called from the disk, so that next 
time when the file is called again, no disk access, needs to be made in 
order to save time right?

However, suppose i have little mem free, say 7 mb and still 200 in 
inactive. Then a program needs to start which needs say 30 mb on mem, will 
also mem be taken from the inactive part and discard the cache?
Some ppl only look at how much free mem is available on their system and 
then sound the alarm, however, shouldnt they add inactive and free 
together in order to see how much mem can be used for newly used programs 
(which didnt run before?).
Bye,

Mipam. 
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: memory usage question

2004-08-17 Thread Matthew Seaman
On Tue, Aug 17, 2004 at 03:39:40PM +0200, Mipam wrote:

 I have a question about usage of memory.
 Despite the well documented articles about it some things are still
 unclear. In top we see memory devided in several items:


Try this article, buy the guy who wrote some very large chunks of the
VM system:

http://www.daemonnews.org/21/freebsd_vm.html

As for the meaning of the different labels top(1) shows attached to
memory sizes: those indicate a sequence of memory caches for different
age levels of pages.  Note that the system doesn't overwrite cached
pages on a timed basis, but rather picks the oldest unused memory to
recycle as and when some other application requests it.  Stuff can
stay in the memory caches for a very long time on a quiet system.

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/misc.html#TOP-FREEMEM

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgpJznDRYHpps.pgp
Description: PGP signature


Re: How to get memory usage for process?

2004-04-09 Thread Uwe Doering
Artem Koutchine wrote:
Hi!

I need to figure out how much memory process really takes.
For example, i am running 100 perl scripts, they are all the
same source and i guess some memory is shared among them
(mostly perl interperter i guess). So, i need to know how much
memory is shared and how much memory is used for each new
running script (including buffers, e.t.c.). What command shoud
do the trick and with what options?
In case you have the PROCFS mounted (usually under /proc) you can get a 
detailed listing of the memory map of a process, together with the 
relevant flags for the various memory segments that indicate memory 
sharing etc.  Try this:

  cat /proc/pid/map

'pid' is of course to be replaced by the PID of the process you want 
to examine.

   Uwe
--
Uwe Doering |  EscapeBox - Managed On-Demand UNIX Servers
[EMAIL PROTECTED]  |  http://www.escapebox.net
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


How to get memory usage for process?

2004-04-06 Thread Artem Koutchine
Hi!

I need to figure out how much memory process really takes.
For example, i am running 100 perl scripts, they are all the
same source and i guess some memory is shared among them
(mostly perl interperter i guess). So, i need to know how much
memory is shared and how much memory is used for each new
running script (including buffers, e.t.c.). What command shoud
do the trick and with what options?

Regards,
Artem

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to get memory usage for process?

2004-04-06 Thread Jan Grant
On Tue, 6 Apr 2004, Artem Koutchine wrote:

 Hi!

 I need to figure out how much memory process really takes.
 For example, i am running 100 perl scripts, they are all the
 same source and i guess some memory is shared among them
 (mostly perl interperter i guess). So, i need to know how much
 memory is shared and how much memory is used for each new
 running script (including buffers, e.t.c.). What command shoud
 do the trick and with what options?

You're probably after the sysutils/pmap utility, in the ports.

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/
...perl has been dead for more than 4 years. - Abigail in the Monastery
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Jesse Guardiani
[EMAIL PROTECTED] wrote:

[...]

 J 1.) Where is my Free memory going?
 
 given what you say
 custom-python-qmail-scanner-clamd-qmail-queue
 
 This whole scenario is very memory intensive. First you have each email
 pythonized and then qmail-scanner is *very* memory intensive, as it has
 initially a very heavy duty perl script for each email before being passed
 off to clamd.

Clamd is a separate issue, since the only clamav command actually run
from the pipeline (and thus under the restrictions of softlimit) is the
clamdscan client, which is NOT memory intensive. Yes, clamd contributes
to the overall memory footprint, but I'm only concerned with getting
softlimit set properly at this point. My machine can always revert to
swap, but the second softlimit is exceeded the email will be temporarily
defered, which I consider a Bad Thing.

Having said that, yes, it is still a very memory intensive pipeline.
I took some time to profile the memory usage a few days ago, and it
looks like the most memory the pipeline should ever use at any given
point in time is ~12780K, with the following processes running:

USER   PID  PPID %CPU %MEM   VSZ  RSS  TT  STAT STARTED  TIME COMMAND
qmaild   24716 24553  0.0  0.2   920  460  ??  I 7:39PM   1:08.07 
/var/qmail/bin/qmail-smtpd
qmaild   24718 24716  0.0  0.3   884  488  ??  I 7:39PM   0:08.63 
/usr/local/bin/qmail-qfilter /var/qmail/queue-filters/block-forged-sender.py -s
qmailq   24730 24718  9.2  2.1  5052 3988  ??  S 7:41PM   0:55.87 
/usr/bin/suidperl -T /dev/fd/4//var/qmail/bin/qmail-scanner-queue.pl (perl)
qmailq   24739 24730 69.7  2.1  5052 3988  ??  R 7:43PM   0:06.55 
/usr/bin/suidperl -T /dev/fd/4//var/qmail/bin/qmail-scanner-queue.pl (perl)
qmailq   24740 24739 14.4  0.2   872  400  ??  R 7:43PM   0:01.28 
/var/qmail/bin/qmail-queue

(qmail-scanner is silly. For some reason it spawns a copy of itself,
possibly to hand the message off to qmail-queue.)

But even with the softlimit set to 15M, my huge test message to a
server with only about 80M of free RAM (before sending the message.
Free Memory dropped to ~500k while handling the message) somehow
managed to exceed the softlimit. The exact same message, sent to
a machine with ~600M of free RAM and an identical mail server setup,
passed through the pipeline without tripping the softlimit.

From what I have seen while watching a huge message pass down the
pipeline, none of the processes in the pipeline increase memory
usage in proportion to email size. They're all relatively static.
So I'm a little confused about why the softlimit would be tripped
on a box that had less RAM (128M) but pass through successfully
on a box with more RAM (1G).

Would the act of using more swap effectively increase a process's:

data segment usage?
stack segment usage?
locked physical pages per process?
total of all segments per process?

These are the things that softlimit limits (according to `man softlimit`),
and I admittedly don't understand how any of the above translates to
memory usage as shown by VSZ and RSS under `ps`, or SIZE and RES under
`top`.

Any ideas?



 Maybe running vmstat -w 1 would give you a different perspective also.

I'll check it out.

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Jesse Guardiani
Dan Nelson wrote:

 In the last episode (Sep 11), Jesse Guardiani said:
 1.) Where is my Free memory going? I can't account for it
 in the SIZE and RES columns of the various processes.
 These are relatively constant.
 
 Disk cache.

I thought it might be something like that. My large test
messages are being written to disk over and over and over
as the message travels down the pipline. Makes a great case
for installing a RAM disk. :)

  
 2.) What, exactly, is RES? `man top` describes it as this:
 RES is the current amount of resident memory, but does
 that mean RES is included in SIZE? Or does that mean that
 RES should be counted in addition to SIZE?
 
 RES the amount of SIZE that it currently in core

OK. To clarify, you mean core kernel memory here?
If so, how is that significant? Why should I care?

In other words, why would I ever want to know that?

Thanks.

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Dan Nelson
In the last episode (Sep 12), Jesse Guardiani said:
 Dan Nelson wrote:
  In the last episode (Sep 11), Jesse Guardiani said:
   
  2.) What, exactly, is RES? `man top` describes it as this:
  RES is the current amount of resident memory, but does
  that mean RES is included in SIZE? Or does that mean that
  RES should be counted in addition to SIZE?
  
  RES the amount of SIZE that it currently in core
 
 OK. To clarify, you mean core kernel memory here?
 If so, how is that significant? Why should I care?
 
 In other words, why would I ever want to know that?

core meaning physical memory; user memory in this case.  Processes can
lock kernel memory, but there's no easy way of listing that (it's
usually a small amount held in pipe or socket buffers and is
short-lived). The name core came from when memory bits were ferrite
rings magnetized by wires running through them.

http://www.columbia.edu/acis/history/core.html

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Lowell Gilbert
Jesse Guardiani [EMAIL PROTECTED] writes:

 Dan Nelson wrote:
 
  In the last episode (Sep 11), Jesse Guardiani said:
  1.) Where is my Free memory going? I can't account for it
  in the SIZE and RES columns of the various processes.
  These are relatively constant.
  
  Disk cache.
 
 I thought it might be something like that. My large test
 messages are being written to disk over and over and over
 as the message travels down the pipline. Makes a great case
 for installing a RAM disk. :)

No, probably not.  The OS disk-caching is probably *more* efficient
than letting the data go into a RAM disk at each stage.  Considerably
so, in fact.  

   
  2.) What, exactly, is RES? `man top` describes it as this:
  RES is the current amount of resident memory, but does
  that mean RES is included in SIZE? Or does that mean that
  RES should be counted in addition to SIZE?
  
  RES the amount of SIZE that it currently in core
 
 OK. To clarify, you mean core kernel memory here?

No, it's not in kernel space.  Core just refers to RAM:  the term is
held over from the days when main memory was constructed out of little
magnetic cores in a wire matrix.

 If so, how is that significant? Why should I care?

If your system starts swapping heavily, that will often be the clue
that tells you why.  Just one example.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Jesse Guardiani
Dan Nelson wrote:

 In the last episode (Sep 12), Jesse Guardiani said:
 Dan Nelson wrote:
  In the last episode (Sep 11), Jesse Guardiani said:
   
  2.) What, exactly, is RES? `man top` describes it as this:
  RES is the current amount of resident memory, but does
  that mean RES is included in SIZE? Or does that mean that
  RES should be counted in addition to SIZE?
  
  RES the amount of SIZE that it currently in core
 
 OK. To clarify, you mean core kernel memory here?
 If so, how is that significant? Why should I care?
 
 In other words, why would I ever want to know that?
 
 core meaning physical memory; user memory in this case.

OK. And how does core, or user memory differ from SIZE memory
then? If X = SIZE - RES, where is X stored?


  Processes can
 lock kernel memory, but there's no easy way of listing that (it's
 usually a small amount held in pipe or socket buffers and is
 short-lived). The name core came from when memory bits were ferrite
 rings magnetized by wires running through them.
 
 http://www.columbia.edu/acis/history/core.html

Wow. That's a really cool bit of history. I don't quite understand
how a core is switched, but I'm sure it must have worked.

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-12 Thread Dan Nelson
In the last episode (Sep 12), Jesse Guardiani said:
 Dan Nelson wrote:
  In the last episode (Sep 12), Jesse Guardiani said:
  Dan Nelson wrote:
   In the last episode (Sep 11), Jesse Guardiani said:

   2.) What, exactly, is RES? `man top` describes it as this:
   RES is the current amount of resident memory, but does
   that mean RES is included in SIZE? Or does that mean that
   RES should be counted in addition to SIZE?
   
   RES the amount of SIZE that it currently in core
  
  OK. To clarify, you mean core kernel memory here?
  If so, how is that significant? Why should I care?
  
  In other words, why would I ever want to know that?
  
  core meaning physical memory; user memory in this case.
 
 OK. And how does core, or user memory differ from SIZE memory
 then? If X = SIZE - RES, where is X stored?

You don't need to store it, since you know SIZE and RES :)  X is any
memory mapped into process space that is not in physical memory at the
moment; it could be dirty or private pages swapped to disk, or program
code that can be pulled from the binary on the filesystem if necessary,
or malloced memory that hasn't been written to yet.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


`top` process memory usage: SIZE vs RES

2003-09-11 Thread Jesse Guardiani
Howdy list,

I checked the FAQ and the questions archive before I posted
this, so hopefully it isn't a frequently asked question:

Background:
=

I am stress testing a FreeBSD 4.7-RELEASE server (it's a pre-
production test server) by sending huge email messages to it
via SMTP.

I'm running qmail-1.03 built from source, with the QMAILQUEUE
patch, qmail-qfilter, a custom Python script that runs under
qmail-qfilter, and qmail-scanner with ClamAV.

I test the server by sending a 59M or a 99M email from a
remote machine (connected via fxp0).

Please, spare me the gaggle about 59M emails being too large.
I am perfectly aware of the silliness associated with sending
a 59M file via SMTP. I'm only interested in stress testing
this server right now. Thanks! Now please read on:


The Situation:
==

As I watch the email travel down the qmail-smtpd-qmail-qfilter-
custom-python-qmail-scanner-clamd-qmail-queue pipeline,
I watch the memory usage with `top`.

Memory is critical in this type of application, since I run my
qmail-smtpd pipeline under DJB's softlimit program. I MUST
know how much memory to allocate for the upper limit of each
pipeline, otherwise qmail-smtpd will terminate the transfer
with a 451 SMTP error.

Anyway, as I watch `top`, I never see more than 15M being used
by the various pipeline programs at any given point in time,
but my Free Memory constantly declines until it reaches about
526k.

The Questions:
==

1.) Where is my Free memory going? I can't account for it
in the SIZE and RES columns of the various processes.
These are relatively constant.

2.) What, exactly, is RES? `man top` describes it as this:
RES is the current amount of resident memory, but does
that mean RES is included in SIZE? Or does that mean that
RES should be counted in addition to SIZE?

Thanks!

-- 
Jesse Guardiani, Systems Administrator
WingNET Internet Services,
P.O. Box 2605 // Cleveland, TN 37320-2605
423-559-LINK (v)  423-559-5145 (f)
http://www.wingnet.net


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-11 Thread Dan Nelson
In the last episode (Sep 11), Jesse Guardiani said:
 1.) Where is my Free memory going? I can't account for it
 in the SIZE and RES columns of the various processes.
 These are relatively constant.

Disk cache.
 
 2.) What, exactly, is RES? `man top` describes it as this:
 RES is the current amount of resident memory, but does
 that mean RES is included in SIZE? Or does that mean that
 RES should be counted in addition to SIZE?

RES the amount of SIZE that it currently in core, and thus should never
exceed SIZE (I don't see any processes on my system that do at least).

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: `top` process memory usage: SIZE vs RES

2003-09-11 Thread gv-list-freebsdquestions
Hello Jesse,

Thursday, September 11, 2003, 5:15:31 PM, you wrote:

J I am stress testing a FreeBSD 4.7-RELEASE server (it's a pre-
J production test server) by sending huge email messages to it
J via SMTP.

I too am putting together a 4.8 box as we speak for a client.

J I'm running qmail-1.03 built from source, with the QMAILQUEUE
J patch, qmail-qfilter, a custom Python script that runs under
J qmail-qfilter, and qmail-scanner with ClamAV.

J I test the server by sending a 59M or a 99M email from a
J remote machine (connected via fxp0).

J As I watch the email travel down the qmail-smtpd-qmail-qfilter-
custom-python-qmail-scanner-clamd-qmail-queue pipeline,
J I watch the memory usage with `top`.

J Memory is critical in this type of application, since I run my
J qmail-smtpd pipeline under DJB's softlimit program. I MUST
J know how much memory to allocate for the upper limit of each
J pipeline, otherwise qmail-smtpd will terminate the transfer
J with a 451 SMTP error.

right.

J Anyway, as I watch `top`, I never see more than 15M being used
J by the various pipeline programs at any given point in time,
J but my Free Memory constantly declines until it reaches about
J 526k.

J The Questions:
J ==

J 1.) Where is my Free memory going?

given what you say
custom-python-qmail-scanner-clamd-qmail-queue

This whole scenario is very memory intensive. First you have each email
pythonized and then qmail-scanner is *very* memory intensive, as it has
initially a very heavy duty perl script for each email before being passed
off to clamd. Multiply this with the default SMTP concurrency limit of
20, and you have a lot of memory usage. Clamd is known to be a memory
piggie too. I switched from that to using fprot which uses less memory and
is faster processing.

J I can't account for it
J in the SIZE and RES columns of the various processes.
J These are relatively constant.

Maybe running vmstat -w 1 would give you a different perspective also.

-- 
Best regards,
Gary

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Limiting memory usage of a certain process.

2003-01-31 Thread Florian Lorenzen
Hi all,

I've got the following problem with my FBSD-4.7-STABLE-box:

It is running a mldonkey-2.02-client under a dedicated user. This
process eats up all memory. Thus the system starts swapping. This is in
general not a big problem but it slows down the whole machine, which is
also running several other services. My question now is how to limit the
mldonkey-precess' memory usage. I've got 64 MB of core and the CPU is a
Pentium 166, so not to fast at all, but sufficient for everything else.
top tells me that under normal load, without the mldonkey, about about
five MB of core are free. mldonkey needs about 20 MB which are resistant
and overall size (as top says) gets up to 70 MB, thus about 80 MB of
swap space get used, nearly zero under normal load. top also says that
about 30 MB of core are wired all the time. I'd like to know, what
this means and wheather it makes sense to decrease this (and if, how),
so that more space is left in RAM.

I tried to limit core-use of mldonkey by putting it into a seperate
login group with a lowered maxmemorysize but that had no effect. I also
niced it up, but that has no effect on swap usage, of course.

So, is there any possibility to speed up the machine except putting in
more physical RAM?

Help appreciated.

Florian

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Limiting memory usage of a certain process.

2003-01-31 Thread Ruben de Groot

Hi,

On Fri, Jan 31, 2003 at 03:26:25PM +0100, Florian Lorenzen typed:
 Hi all,
 
 I've got the following problem with my FBSD-4.7-STABLE-box:
 
 It is running a mldonkey-2.02-client under a dedicated user. This
 process eats up all memory. Thus the system starts swapping. This is in
 general not a big problem but it slows down the whole machine, which is
 also running several other services. My question now is how to limit the
 mldonkey-precess' memory usage. I've got 64 MB of core and the CPU is a
 Pentium 166, so not to fast at all, but sufficient for everything else.
 top tells me that under normal load, without the mldonkey, about about
 five MB of core are free. mldonkey needs about 20 MB which are resistant
 and overall size (as top says) gets up to 70 MB, thus about 80 MB of
 swap space get used, nearly zero under normal load. top also says that
 about 30 MB of core are wired all the time. I'd like to know, what
 this means and wheather it makes sense to decrease this (and if, how),
 so that more space is left in RAM.
 
 I tried to limit core-use of mldonkey by putting it into a seperate
 login group with a lowered maxmemorysize but that had no effect. I also
 niced it up, but that has no effect on swap usage, of course.

When you put it in a separate login class (you do mean class, not group, 
do you?) did you run the command cap_mkdb login.conf?

 
 So, is there any possibility to speed up the machine except putting in
 more physical RAM?
 
 Help appreciated.
 
 Florian
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Limiting memory usage of a certain process.

2003-01-31 Thread Florian Lorenzen
Yep, I mean login class and I ran cap_mkdb afterwards.

Any other hints?

Florian

  I tried to limit core-use of mldonkey by putting it into a seperate
  login group with a lowered maxmemorysize but that had no effect. I also
  niced it up, but that has no effect on swap usage, of course.
 
 When you put it in a separate login class (you do mean class, not group,
 do you?) did you run the command cap_mkdb login.conf?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Question about memory usage

2002-11-19 Thread Matt Winslow
I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
when I had 80.  Well now that I installed more, it's sitting at 93% used
again.  Being newer to BSD, is there a way I can check what is using
memory...or does it just do that automatically?

Thanks for the help!

Matt Winslow
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



RE: Question about memory usage

2002-11-19 Thread Barry Byrne
man top

 - Barry

--
Barry Byrne, IT Manager,
WBT Systems, Block 2, Harcourt Centre
Harcourt Street, Dublin 2, Ireland


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Matt Winslow
 Sent: 19 November 2002 16:13
 To: [EMAIL PROTECTED]
 Subject: Question about memory usage


 I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
 yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
 when I had 80.  Well now that I installed more, it's sitting at 93% used
 again.  Being newer to BSD, is there a way I can check what is using
 memory...or does it just do that automatically?

 Thanks for the help!

 Matt Winslow
 [EMAIL PROTECTED]


 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Question about memory usage

2002-11-19 Thread John Bleichert
On Tue, 19 Nov 2002, Matt Winslow wrote:

 Date: Tue, 19 Nov 2002 11:13:15 -0500
 From: Matt Winslow [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Question about memory usage
 
 I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
 yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
 when I had 80.  Well now that I installed more, it's sitting at 93% used
 again.  Being newer to BSD, is there a way I can check what is using
 memory...or does it just do that automatically?
 
 Thanks for the help!
 
 Matt Winslow
 [EMAIL PROTECTED]
 

BSD will use whatever memory you give it. Especially if you do a large 
compile or something of that nature. Going from 80 MB to 256 MB isn't that 
big of a step, esp. if it's a desktop system. Going from 256 MB to say 1.5 
GB you should see your percentages drop somewhat. That is, for a desktop 
system.

Remember that the memory usage statistics also contain shared memory and 
memory that is cached application data, which may be cleared and reused 
if a new application needs it.

Also, in a server system, if you had 1 GB of memory and only showed 500 MB 
used, you'd have 500 MB of wasted memory to pull out and put in another 
box. 93% sounds like a good usage to me :)

#  John Bleichert 
#  http://vonbek.dhs.org/latest.jpg


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Question about memory usage

2002-11-19 Thread David Schultz
Thus spake Matt Winslow [EMAIL PROTECTED]:
 I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
 yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
 when I had 80.  Well now that I installed more, it's sitting at 93% used
 again.  Being newer to BSD, is there a way I can check what is using
 memory...or does it just do that automatically?

Free memory is wasted memory.  If you have more of it, FreeBSD
will use more, e.g. by caching things longer.  With the additional
memory, you will probably notice that your system is faster and
accesses the disk less frequently under load.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Question about memory usage

2002-11-19 Thread Kris Kennaway
On Tue, Nov 19, 2002 at 11:13:15AM -0500, Matt Winslow wrote:
 I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
 yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
 when I had 80.  Well now that I installed more, it's sitting at 93% used
 again.  Being newer to BSD, is there a way I can check what is using
 memory...or does it just do that automatically?

So you'd prefer that the extra memory you added was just sitting there
unused (i.e. wasted)? :-)

Kris



msg09363/pgp0.pgp
Description: PGP signature


Re: Question about memory usage

2002-11-19 Thread Jerry McAllister
 
 On Tue, Nov 19, 2002 at 11:13:15AM -0500, Matt Winslow wrote:
  I'm running FreeBSD 4.5, on a P-133 system.  I just upgraded my RAM
  yesterday from 80MB to 256MB, because it always used to sit at 93-94% used
  when I had 80.  Well now that I installed more, it's sitting at 93% used
  again.  Being newer to BSD, is there a way I can check what is using
  memory...or does it just do that automatically?

top(1) will show how much memory is allocated to the top resource
using processes.

jerry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



XFree86 memory usage

2002-11-11 Thread Steve Wingate
I'm trying to figure out why X11 is using so much memory on my
workstation. Here is the output from 'top':

  PID USERNAME PRI NICE  SIZERES STATE  C   TIME   WCPUCPU COMMAND
  236 steve  2   0   215M   210M select 1 435:16  0.05%  0.05% XFree86

215MB seems like alot to me. OTOH, this is a dual 1.8Ghz Xeon box with 1GB
RAM so I'm not losing any sleep over it. However I am curious to know if
this is normal or indicative of some memory leaks in applications.
My current environment is Gnome2, although the number doesn't decrease
drastically with Windowomaker either.



+-+
|Steve Wingate  [EMAIL PROTECTED]
|MCSE, CCNA Mon Nov 11 09:59:00 PST 2002
+-+
|FreeBSD 4.7-RC
| 9:59AM  up 23 days, 10:31, 2 users, load averages: 0.11, 0.07, 0.02
+-+


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message