Original Post
This thread is created to factor out a separate off-topic discussion from another thread.
Quote:
Actual response by flodihn Quote:
Original post by hplus0603
@flodihn: Are you using the available tcp_server for client connections, or something else, or rolling your own?
Are you using Erlang process messaging or OTP messaging for clustering clients? If so, in what logical configuration?
I use the OTP tcp_server for my connections servers (the frontline servers in my cluster).
I do not understand your question about Erlang processes messaging or OTP messaging. I am using the OTP framework to structure my code into OTP applications, if that is what you asked. Also I am developing an MMO engine, not a multiplayer engine so I cluster servers, not clients.
Quote:
Actual post by flodihn
I build my servers on a group of gen_servers (in an OTP supervision tree). This means most of my messaging is done with a call to a interface function in a gen_server. However is some places still the "ordinary" ! character for sending messages.
For example one object sends an event to nearby object, the object calls my nextgen.libevent.srv:event function which is a gen server.
The libevent server iterates a mnesia table, extracts the pids and sends the message by calling obj:async_call(Pid, Msg) for example.
In turn obj:async_call just wraps the messaging.
When a message arrives from the client, I use for example rpc:call(node(Pid), obj, async_call, [Args]) to forward it to the correct area server.
To summarize, most of messaging is done through calling interface functions in OTP servers. Those cases where I do normal Erlang messasing, I wrap it in a function call.
I feel we risk of hijacking the OP post. If you want to get into detail I suggest we create a post of our own.
Quote:
Original post by hplus0603
When the client node decodes a message that needs to go to a chat channel (in this case), the job of getting to the right process doesn't really have a good solution in OTP that I can find.
Quote:
why don't store you store that process id instead of the node
Quote:
I design for 10,000,000 names. Sticking them all in a map is not reasonable.Quote:
Instead, I hash all the names, and map (hash mod N) to a set of buckets, and map each bucket to a node
Quote:
Because I design for 10,000,000 names. Sticking them all in a map is not reasonable
Quote:
My question for OTP or Erlang messaging is, when you receive a message from a client, and it needs to be forwarded, do you use an OTP application name on a destination node (with gen_server:cast or similar), or do you use a pid, or something else?
I'm working on a clustered OTP server for a messaging fabric at work, and we end up using raw pids for intra-cluster messaging, even though we use OTP for the supervision tree. I want to compare to other applications, to see whether there is something we're missing.
Quote:
Are you sure about this, I just added 10 000 000 rows in a mnesia table, it took about 1.2 GB of memory, it takes about 20 seconds to iterate and read all the elements, taking a random row to read takes about 0.012 milliseconds (12 microseconds).
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more