Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Swap Use
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Swap Use

serverianserverian Member
edited October 2012 in General

Hello,

For testing, I've created a VM on a KVM node with 54MB of RAM. Running Debian Squeeze 64Bit. I've created around 2GB of SWAP (on a RAID 10 SSD array of 16 drives).

I've installed apache2 then ran ab -kc 1000 -t 30 http://localhost/

After it used all the memory except the last 1 MB, it started using the SWAP area. The vm.swappiness = 100

It used 54MB of SWAP and started to kill the processes, and after a while it returned a kernel panic.

I'm confused here, why it didn't use all the swap instead an exact amount of installed RAM?

I was typing free -m at the process of this, and when it started killing processes the free -m looked like this:

root@debian:~# free -m
total used free shared buffers cached
Mem: 54 53 1 0 0 2
-/+ buffers/cache: 51 3
Swap: 1875 54 1821

Oktay

Comments

  • Oktay: check this link http://serverfault.com/questions/362506/oom-killer-killing-things-with-plenty-of-free-ram and the redhat link from the comments.

  • @craigb, it seems it's hard to make the system use the swap efficiently.

  • Could you try the same experiment either limiting the max mem a single apache process can consume (in apache.conf) or using lighttpd or nginx?

  • @craigb, how would that affect it?

  • Well I guess it comes down to what you are trying to prove. We can tweak apache settings to have it handle an onslaught of requests without bringing down the system (to a point). The OOM killer is triggered when the kernel swapper can't free up sufficient contiguous RAM to handle a memory allocation request (e.g. Fragmented memory) or if the memory mgmt data structures themselves cant be allocated (in RAM - cant swap those out). You're wondering why Linux isn't using more swap, I'm suggesting that apache memory usage/settings are creating a memory condition the swapper is unable to handle. Hence either change apache config or change webserver....

  • Well, I was just trying to make the swap to be used in full and see the performance of using SSD as memory. However, yeah probably if I use 128 or 256MB ram and have swappiness = 100 then I would be able to use good amount of SWAP.

  • I don't know - only reducing swap to 128MB and running the same test should not change how much swap gets used. Or did I misunderstand what you meant?

  • From what I understand from you and that thread. The kernel needs to have some free memory to swapped on the swap area. So, having enough memory would help the system to swap more.

  • Sorry I misread RAM as swap above. Yes I agree with you :)

Sign In or Register to comment.