[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: unix memory question

jim martin wrote:
Hi.. I am curious to know how unix define memory usage.  When I type "free" or top, I saw the used
memory is so much as shown below.  But my server is actually idle.  In the top's process show that
the highest memory usage process is only taking up 0.5%. why? the Free command shows used memory
is so much?

[root wat]# free
             total       used       free   shared  buffers   cached
Mem:       1027344     922496     104848   0       124304    589148
-/+ buffers/cache:     209044     818300
Swap:      2031608          0    2031608

`free` is showing you that of your 1GiB of RAM, 922496KiB are used. Of those, 124304KiB are used by the kernel for buffers, and 589148KiB are used by the kernel for cache. The latter two are performance enhancements, and most of this can be dropped to free memory when required, without writing anything to disk.

Because that RAM can be freed at essentially no cost, the second line shows you that 209044KiB are used by the kernel and user applications and would have to be swapped out in order to free RAM. The other 818300KiB are mostly in use (the buffers and cache reported above), but are "free" for most intents and purposes.

Besides, I heard from my friend that there is a method to allocate memory for different process.
For example 30% for apache and 40% for tomcat. Is that true? How to do it?

You can use ulimit to cap resource use, but most people won't. Before you do, you should benchmark the server well to make sure you know what the processes will use in real-life use.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]