# [erlang-questions] Distributing things

Fabio Mazanatti Nunes <>
Sat Nov 7 22:28:32 CET 2009

```Hi Calum,

as I said, my scenario may be weird, and indeed it is :-)
But I can't see why it wouldn't use as many nodes as possible - I defined
that the range interval was 5000, but could be any other number, fixed or
derived from a calculation considering the # or digits and the # of active
nodes, for instance.

Anyway, my goal was to put an example of coordination and distribution. if
each node works on a single number or a predefined range is not relevant -
someone (a central module, for instance) has to control and pass the
information along.

You may know how many nodes will be available at production, but most of
time you don't build your solution considering it. I'm working actively with
Java EE, and always built applications targeting "clusters" (with any number
of members), not a specific number of instances. If you need more power, you
just add more nodes (or instances) to the environment.

So, your idea of abstracting the number of actual nodes of a solution is the
right way to go, at least to me :-)

Ciao!

On Sat, Nov 7, 2009 at 7:02 PM, Calum <> wrote:

> On Sat, Nov 7, 2009 at 8:55 PM, Fabio Mazanatti
> <> wrote:
> > Hi,
> >
> > the scenario I imagined for this exercise, based on Calum's text would be
> > something like assigning a range of numbers to each node, starting with
> the
> > lowest possible given by the entry parameter (the # of digits),
> controlling
> > its distribution and wrapping things up when a prime number is found by
> one
> > of the nodes.
> >
> > An example: 4 nodes, generating a prime with 6 digits, would start at
> > 100.000. The entry point would assign a range from 100.000 to 105.000 to
> > node 1, 105.001 to 110.000 to node 2, and so on. When a node finishes
> > traversing a range, a new block is assigned to it, until one of them
> returns
> > a valid value, and processing stops.
>
> Hello Fabio,
>
> Yes, this is the sort of thing I would do for this problem.
> However, for other problems, perhaps the splitting method isn't so
> clearcut.
> Also, your method only really allows for 20 nodes - what would you do
> if you suddenly had 50 nodes available to join in?
>
> Actually, in the real world, do Erlang node clusters vary in size a
> lot during operation, or do most people know how many nodes they have
> available at the start, and just program for that?
> Is my attempting to cope with varied node numbers something that just
> isn't really needed?
>
```