[erlang-questions] pid to integer and back
Wed Oct 8 21:04:50 CEST 2008
On Wed, Oct 8, 2008 at 6:01 PM, Joel Reymont <> wrote:
> Is there a safe and efficient way to convert pid to integer and back?
> I'm assigning each running poker game an integer id. I store this id
> into every outgoing packet so there's no database lookup.
> I use the id to lookup the game process for every incoming packet,
> though. This is proving to be extremely inefficient, even with dirty
> mnesia reads.
> I actually repeat the above for every player, so there's twice the
> overhead. Is there a way to avoid it?
> This would only apply to running games and connected players so this
> would be a temporary integer, valid while the process is alive.
> Thanks, Joel
> Hi Joel.
I haven't - shame on me - looked at your code for the poker server, so this
may be a stupid question...
Could you try to step one step back and explain a bit about the scenario and
the requirements you have for the routing of messages. I presume that you
have local clients that all connect to your server and the trick is to pass
actions around to all players at a table, but how that matches up with
Erlang entities is beyond me at this stage.
Off the top of my head things like AMQP or IP multicast could be a neat way
of solving your problem, but it depends on how your architecture is and
exactly how your routing requirements are. I have practical experience with
IP multicast and I am sure that the RabbitMQ guys could help out with
guidance on using AMQP.... if those things match your needs.
It might very well be that the pid conversion is a problem you do not need
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions