[erlang-questions] RE gen_server bottleneck
Olivier BOUDEVILLE
olivier.boudeville@REDACTED
Fri Dec 14 18:02:46 CET 2012
Hello Sarva,
I suppose it depends on how scalable you want to be; I think the first
approach is to lean first on your simulation algorithm; is the management
of your discrete time event-driven or time-stepped?
In either case you have solutions to implement a parallel evaluation of
model instances with Erlang (for example, in the first case, with a
conservative or optimistic scheduling), knowing that maintaining a
centralised event queue on which the engine would iterate sequentially
will induce by design immediate bottlenecks.
Once the parallel algorithm is implemented (most probably making use of
SMP resources), to obtain further scalability gains it is probably useful
to split it into, say, a tree of time managers where communications
between time managers could be a lot terser than between a time manager
and the local model instances it would manage; this would open the way to
a still more parallel mode of operation - and would immediately offer the
opportunity for distribution, which might be efficient, at least to some
extent.
Finally I would go for a raise in the priority of the time manager
processes and other key simulation services, efficient data-structures for
scheduling, load balancing and smart placement of model instances to
minimize the number of messages sent over the network and the induced
latency.
Then only I would go for fancy hardware, detailed profiling, native
compilation, C-nodes and the like!
<plug>
At least it is the path we are going through with Sim-Diasca (which is an
open-source generic discrete-time simulation engine, maybe not too far
from what you intend to do, cf http://www.sim-diasca.com). In this
process, we are currently just before the profiling.
</plug>
Hope this helps!
Best regards,
Olivier.
---------------------------
Olivier Boudeville
EDF R&D : 1, avenue du Général de Gaulle, 92140 Clamart, France
Département SINETICS, groupe ASICS (I2A), bureau B-226
Office : +33 1 47 65 59 58 / Mobile : +33 6 16 83 37 22 / Fax : +33 1 47
65 27 13
erlang-questions-bounces@REDACTED a écrit sur 14/12/2012 14:39:07 :
> Hi all,
> I have been trying to write a network simulator in Erlang
> modelled on ns-3. The code can be found at
https://github.com/avras/nsime
>
> NSIME is a discrete event simulator where a registered gen_server
> process nsime_simulator holds all the events to be simulated in a
> gb_trees sorted by event time. This process has become a bottlneck
> when the simulation is large as multiple entities try to schedule
> events by doing a call on the single nsime_simulator process. I am
> still a newbie in Erlang profiling so this is more of a hunch
> arising from running the example scenarios.
>
> How can I remove this bottleneck?
>
> Thanks in advance
> sarva_______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.
Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.
Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
____________________________________________________
This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.
If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.
E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121214/42689303/attachment.htm>
More information about the erlang-questions
mailing list