You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by MK <mk...@cognitivedissonance.ca> on 2011/06/22 14:50:46 UTC
256kB stack size ok?
Does anyone have an idea of what a safe minimum stack size is for
couch? I have it on a linux openVZ slice, and OVZ counts something
called "allocated memory" which AFAICT most closely resembles the
"writable/private" stat found with pmap -d.
At start-up, beam.smp has 12 threads; with a default stack of 8MB each,
that's 96MB. After a while it grows to 25 threads and about a 1/4 GB
of "allocated memory". I'd expect that to be the minimum using a
default stack size.
So I cut the system stack size to 256kB, which reduced my overall mem
usage by more than half, and WRT to couch, about 90%. Everything
seems okay, but am totally unfamiliar with erlang, and was just
wondering if someone in the know here can provide some reassurance.
--
"Enthusiasm is not the enemy of the intellect." (said of Irving Howe)
"The angel of history[...]is turned toward the past." (Walter Benjamin)
Re: 256kB stack size ok?
Posted by MK <mk...@cognitivedissonance.ca>.
On Wed, 22 Jun 2011 14:34:25 -0700
Randall Leeds <ra...@gmail.com> wrote:
> On Wed, Jun 22, 2011 at 05:50, MK <mk...@cognitivedissonance.ca> wrote:
> > Does anyone have an idea of what a safe minimum stack size is for
> > couch?
> This is an excellent question and it'd be really cool to hear some
> good thoughts on this.
>
> In particular, I'm not sure what (from a libc perspective) is stack
> allocation and what is heap allocation in the Erlang runtime.
> Looking around quickly it's not easy to find documentation on BEAM
> itself (Bogdan/Björn's Erlang Abstract Machine).
I did not even know that's what it is, thanks ;)
> Perhaps there are some more basic questions that we could cross-post
> to erlang?
I don't think you could simplify it beyond "Do you know how big a stack
this application needs?" 256kB seems like a lot to me, I have no idea
why someone would need the linux default of 8MB.
You can limit thread stack size internally, at least with pthreads. I
noticed when doing this on the server that nodejs (or the "libeio"
it includes/uses) does that -- it has a very small "allocated memory"
footprint by default. Kind of a lesson there for developers perhaps.
That beam thing is just colossal, at least on linux.
--
"Enthusiasm is not the enemy of the intellect." (said of Irving Howe)
"The angel of history[...]is turned toward the past." (Walter Benjamin)
Re: 256kB stack size ok?
Posted by Randall Leeds <ra...@gmail.com>.
On Wed, Jun 22, 2011 at 05:50, MK <mk...@cognitivedissonance.ca> wrote:
> Does anyone have an idea of what a safe minimum stack size is for
> couch? I have it on a linux openVZ slice, and OVZ counts something
> called "allocated memory" which AFAICT most closely resembles the
> "writable/private" stat found with pmap -d.
>
> At start-up, beam.smp has 12 threads; with a default stack of 8MB each,
> that's 96MB. After a while it grows to 25 threads and about a 1/4 GB
> of "allocated memory". I'd expect that to be the minimum using a
> default stack size.
>
> So I cut the system stack size to 256kB, which reduced my overall mem
> usage by more than half, and WRT to couch, about 90%. Everything
> seems okay, but am totally unfamiliar with erlang, and was just
> wondering if someone in the know here can provide some reassurance.
>
This is an excellent question and it'd be really cool to hear some
good thoughts on this.
In particular, I'm not sure what (from a libc perspective) is stack
allocation and what is heap allocation in the Erlang runtime.
Looking around quickly it's not easy to find documentation on BEAM
itself (Bogdan/Björn's Erlang Abstract Machine).
I realize I don't even know if it's stack-based, what kind of
registers it has, etc...
Perhaps there are some more basic questions that we could cross-post to erlang?