Gen_server and Gen_fsm questions
Casper
casper2000a@REDACTED
Tue Jan 4 13:24:59 CET 2005
Hi Joe,
Wish you a happy new year too. And thanks a lot for your valuable advice.
I have a BIG picture. A picture of a common platform, very generalized,
which has Telecom applications such as SMSC, IVR, Prepaid, HLR, SCP, etc as
pluggable modules (or applications). One module to handle ISUP Call control,
one module for IVR functions, one for Prepaid functions, one for TCAP, one
for SMS handling, one OAM, etc., distributed and having full redundancy.
I'm kind of tired by doing various platforms in various languages and
platforms. MMSC runs on any, since it's done using Java, SMSC on Linux
C/C++, IVR on Win32 VC, etc. These developments are started in different
levels/times, so has not come under one platform. Also maintenance and
debugging takes a lot of time. DBMS is not giving the required transaction
speed, etc. So I want all of them to come under one platform, and I'm
getting very much convinced, under Erlang/OTP platform.
I know it'll be difficult to start, but I'm sure it's worth doing. So at the
moment I'm investigating the architectures of other platforms developed
using Erlang. It's kind of hard to find any good documentation of such a
system.
If any of you can give me any advice/reference materials regarding above
discussion, I greatly appreciate.
Thanks!
Eranga
-----Original Message-----
From: Joe Armstrong (AL/EAB) [mailto:joe.armstrong@REDACTED]
Sent: Tuesday, January 04, 2005 4:16 PM
To: 'Casper'; 'Vance Shipley'
Cc: erlang-questions@REDACTED
Subject: RE: Gen_server and Gen_fsm questions
> If I have one/two process for each call, then if I maintain let's say
> 100,000 simultaneous calls, I will have to create 200,000 gen_fsm, ie.
> Processes.
Yes
> Is that a Good method?
Yes
> Will that create unnecessary system overhead?
No
It's exactly the right way to think.
You have to get used to thinking in terms of processes - creating processes
is a light-weight operation (this means you can create lot's of them very
quickly).
No you might run into memory problems - I don't know what the minimum size
of a process is
but let's guess 1KB - so your 200 K process might take 200M of memory and
that might
be a problem.
But suppose you were to do it some other way - suppose you "suspend" a
process when it's not
doing anything useful - you have to store it's data structures somewhere -
you have to
make it go away, store it's data structures, then at a later stage wake it
up and
restore it's data structures etc. All of this takes lots of unnecessary code
and there's no guarantee that it's quicker.
Even storing the data structures required by suspended processes takes space
so doing this might not be a good idea.
The Erlang "way" is to identify all the truly parallel activities in your
application and then assign exactly ONE process per activity. (The exactly
ONE bit is important) -
this makes the code isomorphic to the problem - and easy to write understand
and debug.
So first you do as I have suggested - THEN you measure and possibly
optimise.
First make it right - then make it fast.
Happy new Year
More information about the erlang-questions
mailing list