Memory

1 view
Skip to first unread message

Andy Jarrett

unread,
Apr 23, 2009, 7:17:25 PM4/23/09
to Railo
Hi

I've got myself a new shiny VPS with 512mb memory. Im only going to be
running a few site like my site. So the traffic isn't going to be to
heavy. What I am trying to figure out is the best settings.

Currently I am using Resin for serving Railo and web pages. When I do
"Free -m" from the terminal I am getting the following

total used free shared
buffers cached
Mem: 512 506 5 0 10
87

Having 5mb free seems a little too close to the mark for me :) Is this
right? If not what can I do to free some memory up?

Thanks

Andy J

Barney Boisvert

unread,
Apr 23, 2009, 7:22:41 PM4/23/09
to ra...@googlegroups.com
What is the second line of the output? Linux automatically uses all
the RAM you've got for caching and stuff. The first line is total
usage, so it's always close. The second line is usage without
counting the OS-internal buffers and cache and is the "real" RAM
utilization. Here's mine:

total used free shared buffers cached
Mem: 994 981 13 0 4 208
-/+ buffers/cache: 768 226

I've got 13M free, but there are 226M available for applications. The
OS is using 213M to speed things along (mostly by caching disk reads
for common sectors).

cheers,
barneyb
--
Barney Boisvert
bboi...@gmail.com
http://www.barneyb.com/

Andy Jarrett

unread,
Apr 23, 2009, 7:26:12 PM4/23/09
to Railo
quick reply Barney :)

Here the full dump

total used free shared
buffers cached
Mem: 512 487 24 0 2
72
-/+ buffers/cache: 411 100
Swap: 1023 9 1014

So i've got 100mb free at the moment for apps is that right?

Barney Boisvert

unread,
Apr 23, 2009, 7:28:12 PM4/23/09
to ra...@googlegroups.com
Yeah, exactly, and the OS is using that other 76M for buffers and
cache. Linux is smart like that.

cheers,
barneyb

Andy Jarrett

unread,
Apr 23, 2009, 8:00:52 PM4/23/09
to Railo
Just to pick your brains some more then Barney

Whats the best way of making sure I have a good amount of memory to
remain free?

Barney Boisvert

unread,
Apr 23, 2009, 8:04:06 PM4/23/09
to ra...@googlegroups.com
A very good question. Try to avoid memory leaks? Don't overload your
box. Profile your apps to see what kind of usage you can expect under
load and then ensure the aggregate of all apps on the box is
appropriate for the available resources. That kind of tuning stuff is
notoriously hard to generalize since it's so environment and
application (and often deployment) dependent.

You can certainly set up monitoring with relative ease to email/SMS
you if you cross a certain threshold, but that's obviously reactive.

cheers,
barneyb

Peter Boughton

unread,
Apr 23, 2009, 8:22:23 PM4/23/09
to ra...@googlegroups.com
Are there any specific profiling / load testing apps that you would recommend?

Andy Jarrett

unread,
Apr 24, 2009, 2:13:20 AM4/24/09
to Railo
While im still looking at memory today (im getting a little obsessive)
i ran "TOP" then shift-m to sort my memory usage. Below are my top two
records:


PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
19800 root 20 0 551m 307m 9368 S 0 60.1 18:36.37
java
19771 root 20 0 358m 77m 8264 S 0 15.2 0:56.93 java

I've got Java taking up a total of 75.3% if my machine's memory. I'm
assuming at this point some of the resin.conf <jvm-arg> are wrong, or
again is this typical?

Cheers

Barney Boisvert

unread,
Apr 24, 2009, 11:00:33 AM4/24/09
to ra...@googlegroups.com
Java is my biggest consumer as well. It's not necessarily bad, just
something you need to watch (like anything else). I'm of the opinion
that the JVM's capabilities are worth it. That said, you can probably
tune your config and reduce it somewhat, but make sure you do that
under load, because you might need that RAM when you have a lot of
traffic.

In short, you don't have a problem until you have a problem. ;)
Unused RAM is wasted RAM, and while Linux's use of unued RAM for
caching and buffering is good, direct application usage will improve
performance to a larger degree in most cases.

cheers,
barneyb
---
Barney Boisvert
bboi...@gmail.com
http://www.barneyb.com

On Apr 23, 2009, at 11:13 PM, Andy Jarrett <andy.j...@gmail.com>
wrote:

>
Reply all
Reply to author
Forward
0 new messages