You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Donna Li <do...@utstar.com> on 2011/06/13 09:09:29 UTC

答复: swap

Thanks ted.
I want to know the relation between java heap size and swap. Zookeeper physical memory is enough, but swap is used by 302064k. Should I increase my java heap size or decrease my java heap size?

-----邮件原件-----
发件人: Ted Dunning [mailto:ted.dunning@gmail.com] 
发送时间: 2011年6月13日 14:33
收件人: user@zookeeper.apache.org
主题: Re: swap

This sounds like a question with a story behind it.

Do you mean that your ZK server filled up all of memory and caused the
machine to start swapping?

If that is your problem, then there really is no fix other than to not
do that.  The reason is that Zookeeper is memory based so if you don't
have enough memory, either because you are over-filling Zookeeper or
have insufficient memory, then things aren't going to work.

Turning off swap may be one of the worst things to do in this case
since the machine will tend to fail harder instead of just getting
very slow.  That can make recovery more difficult.

On Mon, Jun 13, 2011 at 5:52 AM, Donna Li <do...@utstar.com> wrote:
>
> Hi, all:
>        How to avoid swap on zookeeper server?
>
> Best Regards
> Donna li
>

Re: RE: swap

Posted by Camille Fournier <ca...@apache.org>.
To add on to this, you know how much memory your vm can allocate, you know
how much memory your system has. You shouldn't allocate more memory to the
zk vm than the system has minus a percentage for overhead. If you don't have
enough space on the machine to run zk without swapping, the machine is too
small for your use case.
On Jun 13, 2011 9:38 AM, "Fournier, Camille F." <Ca...@gs.com>
wrote:
> My advice is to turn off disk swap completely if you are using the machine
to run only ZK, or any app which should always have its entire heap in
memory. Disk swapping by java heaps is very, very bad for apps with
performance driven by caching all state. You will need to leave some amount
of memory for OS overhead (it's been too long since I did that analysis but
I would make sure it is at least in the neighborhood of 10% of the total
available memory).
>
> C
>
> -----Original Message-----
> From: Donna Li [mailto:donna.li@utstar.com]
> Sent: Monday, June 13, 2011 3:09 AM
> To: user@zookeeper.apache.org
> Subject: 答复: swap
>
> Thanks ted.
> I want to know the relation between java heap size and swap. Zookeeper
physical memory is enough, but swap is used by 302064k. Should I increase my
java heap size or decrease my java heap size?
>
> -----邮件原件-----
> 发件人: Ted Dunning [mailto:ted.dunning@gmail.com]
> 发送时间: 2011年6月13日 14:33
> 收件人: user@zookeeper.apache.org
> 主题: Re: swap
>
> This sounds like a question with a story behind it.
>
> Do you mean that your ZK server filled up all of memory and caused the
> machine to start swapping?
>
> If that is your problem, then there really is no fix other than to not
> do that. The reason is that Zookeeper is memory based so if you don't
> have enough memory, either because you are over-filling Zookeeper or
> have insufficient memory, then things aren't going to work.
>
> Turning off swap may be one of the worst things to do in this case
> since the machine will tend to fail harder instead of just getting
> very slow. That can make recovery more difficult.
>
> On Mon, Jun 13, 2011 at 5:52 AM, Donna Li <do...@utstar.com> wrote:
>>
>> Hi, all:
>>        How to avoid swap on zookeeper server?
>>
>> Best Regards
>> Donna li
>>

RE: swap

Posted by "Fournier, Camille F." <Ca...@gs.com>.
My advice is to turn off disk swap completely if you are using the machine to run only ZK, or any app which should always have its entire heap in memory. Disk swapping by java heaps is very, very bad for apps with performance driven by caching all state. You will need to leave some amount of memory for OS overhead (it's been too long since I did that analysis but I would make sure it is at least in the neighborhood of 10% of the total available memory). 

C

-----Original Message-----
From: Donna Li [mailto:donna.li@utstar.com] 
Sent: Monday, June 13, 2011 3:09 AM
To: user@zookeeper.apache.org
Subject: 答复: swap

Thanks ted.
I want to know the relation between java heap size and swap. Zookeeper physical memory is enough, but swap is used by 302064k. Should I increase my java heap size or decrease my java heap size?

-----邮件原件-----
发件人: Ted Dunning [mailto:ted.dunning@gmail.com] 
发送时间: 2011年6月13日 14:33
收件人: user@zookeeper.apache.org
主题: Re: swap

This sounds like a question with a story behind it.

Do you mean that your ZK server filled up all of memory and caused the
machine to start swapping?

If that is your problem, then there really is no fix other than to not
do that.  The reason is that Zookeeper is memory based so if you don't
have enough memory, either because you are over-filling Zookeeper or
have insufficient memory, then things aren't going to work.

Turning off swap may be one of the worst things to do in this case
since the machine will tend to fail harder instead of just getting
very slow.  That can make recovery more difficult.

On Mon, Jun 13, 2011 at 5:52 AM, Donna Li <do...@utstar.com> wrote:
>
> Hi, all:
>        How to avoid swap on zookeeper server?
>
> Best Regards
> Donna li
>

Re: 答复: swap

Posted by Ted Dunning <te...@gmail.com>.
There is no way to answer this without a LOT more information.  If you
want a good answer instead of guesses, you need to provide this
additional information.

In general, you have to account for ALL of the uses of memory on the
machine.  There are many uses and you can't simply give Zookeeper a
heap that is as large as your memory.  You also have to determine
whether the swap being used is simply because of memory over-commit or
if the machine is actually swapping.

My guess is that the Zookeeper team is not going to be able to help
you.  The problem here is not Zookeeper related, but is simply a basic
system administration issue.

You need to find a local expert who can look at your system to
determine what the situation is.  The expert should be a linux expert,
not a zookeeper expert.

On Mon, Jun 13, 2011 at 7:09 AM, Donna Li <do...@utstar.com> wrote:
> Thanks ted.
> I want to know the relation between java heap size and swap. Zookeeper physical memory is enough, but swap is used by 302064k. Should I increase my java heap size or decrease my java heap size?
>
> -----邮件原件-----
> 发件人: Ted Dunning [mailto:ted.dunning@gmail.com]
> 发送时间: 2011年6月13日 14:33
> 收件人: user@zookeeper.apache.org
> 主题: Re: swap
>
> This sounds like a question with a story behind it.
>
> Do you mean that your ZK server filled up all of memory and caused the
> machine to start swapping?
>
> If that is your problem, then there really is no fix other than to not
> do that.  The reason is that Zookeeper is memory based so if you don't
> have enough memory, either because you are over-filling Zookeeper or
> have insufficient memory, then things aren't going to work.
>
> Turning off swap may be one of the worst things to do in this case
> since the machine will tend to fail harder instead of just getting
> very slow.  That can make recovery more difficult.
>
> On Mon, Jun 13, 2011 at 5:52 AM, Donna Li <do...@utstar.com> wrote:
>>
>> Hi, all:
>>        How to avoid swap on zookeeper server?
>>
>> Best Regards
>> Donna li
>>
>