Design – Erlang chat app design

chatdesignerlangnode.js

I have a chat app made in node/socket.io.

Scalability factors have made us choose Erlang/Ejabberd/xmpp and it will replace node/socket.

I have a few questions:

  1. Currently using MySql for chat storage. Best alternative considering scaling and consistency as major factor?
    Reason why I am switching : a row for single message is not the best thing to do, but since I am using MySql I am not left with any other option. Growing userbase doesn't help either.(Mnesia|Riak|MySql|PosgreSQL??)

  2. How to send my chat messages from javascript to my Erlang code for storing/processing. I have done web development in past and ajax made my task very simple for client-server interaction. Node/socket event handler made my job easy while developing chat app. How will server and client interact in this scenario?

Best Answer

  1. Why not use something like Amazon s3 for your chat storage? I don't think you're going to find a higher scalability or availability outside of hosting your own cloud. Not sure how long your messages need to be stored either (Until the end of time?).

  2. You're looking to have Erlang support REST services right? Here's a relevant SO question which namely calls out Mochiweb, Webmachine and Nitrogen. These will allow you to send and receive REST events to an erlang server. If you want to do AJAX over that, you could.

Related Topic