[erlang-questions] Caching server

Eric Merritt <>
Mon Feb 21 16:12:31 CET 2011


There is some overhead,  according to the docs its 327 words (8 bytes)
and that includes 233 words of heap space, thats 249 mb per 100,000
processes more or less. So there is some memory overhead but not a
terribly large amount and it makes the handling of k,v pairs in a
cache (where those k,v pairs have behavior) much more elegant. As
always do the beautiful thing first, then if you must, do the
efficient thing. Hopefully the are both the same.

On Mon, Feb 21, 2011 at 9:41 AM, Rapsey <> wrote:
> Erlang can handle a large number of processes, but I don't really think
> having a process for every k/v pair is that good of an idea unless the
> amount of k/v pairs is relatively small. Processes are lightweight, but
> they're not that lightweight, you're still adding quite a few bytes to every
> k/v pair which adds up to quite a lot when you're in the hundreds of
> thousands or millions of k/v pairs.
>
>
> On Mon, Feb 21, 2011 at 3:26 PM, Eric Merritt <>
> wrote:
>>
>> Nicholas,
>>
>> The example in the book isn't production capable, and was designed for
>> teaching more then to be production. However, this approach should be
>> fine in Erlang. Erlang can handle extremely large numbers of processes
>> on commodity hardware. The big caveat to this is you need to figure
>> out what the number of processes that can live on the hardware you are
>> going to be using, then come up with a distribution mechanism if that
>> number is exceeded. Fortunately in erlang this isn't a big deal. This
>> number is probably very high, at the very least in the hundreds of
>> thousands and maybe into the millions depending on your hardware. As
>> always, the key is doing some testing and figuring out what your
>> limits are.
>>
>> Eric
>>
>> On Fri, Feb 18, 2011 at 9:19 PM, Nicholas Wieland <> wrote:
>> > Hi *, I'm reading the Manning book.
>> > My question is very simple: a full chapter of the book is devoted to the
>> > implementation of a simple caching server. The author, if I got it
>> > correctly, at one point states that in Erlang, thanks to its lightweight
>> > processes, it's ok to have a caching server that spawns a process for every
>> > key/value pair.
>> > Of course I don't expect that the example in the book is a production
>> > ready implementation, but I would like to ask if it would be possible for an
>> > architecture like this to be production ready (say, something like Redis),
>> > or if I should take it with a pinch of salt, only as a demonstration.
>> > This thing made me curious because there's no language or technology
>> > that would permit something like this, hence my question :)
>> >
>> > TIA,
>> > --
>> > Nicholas Wieland
>> > 
>> > StyleJam BDFL
>> >
>> > The only "intuitive" interface is the nipple. After that it's all
>> > learned. – Bruce Ediger
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ________________________________________________________________
>> > erlang-questions (at) erlang.org mailing list.
>> > See http://www.erlang.org/faq.html
>> > To unsubscribe; mailto:
>> >
>> >
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:
>>
>
>


More information about the erlang-questions mailing list