A microservice used in oorja for soft-realtime messaging between room participants and relaying important events that happen at the backend.
This service is written in elixir using the phoenix framework.
- oorja needed a realtime messaging functionality between room participants. Elixir felt like the perfect tool I could use for this purpose. It's fault tolerant, highly availabile and distributed. You get a lot of stuff for free.
- Phoenix framework can also track user presence using distributed pubsub.
- Performance: Initial version of oorja used to watch mongodb oplog for any updates to the
Room
documents and then used to push the changeset to the room participants. It is how pub/sub works in a meteor app. However cpu usage grows with the number of subscriptions. Now the backend knows when a room document has changed since it is solely responsible for it, so instead of watching the db for changes, the backend now hits Beam to broadcast an event that the room document is updated. Anyone subscribed to the room channel can fetch the updates when they recieve such an event. So in affect pub/sub was removed from the meteor app, bringing down its cpu usage.
- Install Elixir
- In the project root
- Install dependencies with
mix deps.get
- Start Phoenix endpoint with
mix phx.server
- Install dependencies with
The service should now be running at port 5000
.
- Official website: http://www.phoenixframework.org/
- Guides: http://phoenixframework.org/docs/overview
- Docs: https://hexdocs.pm/phoenix
- Mailing list: http://groups.google.com/group/phoenix-talk
- Source: https://github.com/phoenixframework/phoenix