Erick Camacho @ecamacho
November 2016
ex - Nubleer (a mexican startup)
We were using Go
Great performance an a small memory footprint
It isn't dynamic
It's hard to model complex objects hierarchies
Fault tolerance has to be managed by hand
mix new recommendations --module Recommendations --sup
mix new payments --module Payments --sup
#In your phoenix app
defp deps do
[{:phoenix, "~> 1.2.1"},
...
{:payments,
git: "git@yourgitserver.com:nubleer/payments.git",
checkout: "0.0.1"},
{:recommendations,
git: "git@yourgitserver.com:nubleer/payments.git",
checkout: "0.0.1"},
]
end
#In your phoenix app
def application do
[mod: {Services, []},
applications: [:phoenix, ...,
:payments, :recommendations]]
end
mix new nubleer --umbrella
#inside apps folder
mix phoenix.new services
mix new recommendations --module Recommendations --sup
mix new payments --module Payments --sup
defp deps do
[{:phoenix, "~> 1.2.1"},
...
{:payments, in_umbrella: true},
{:recommendations, in_umbrella: true},
]
end
No need to update mix dependencies
All on the same repo
reload() works!
Global GenServer
Example: A gen server that calculates the trending magazines for each day
Creates a Gen Server each time a request is made
One process per user
Example: We create a GenServer each time a user requests her personalized recommended ebooks
Creates a pool of GenServers and load balance messages among them
Example: We create a set of RabbitMQ listeners per each RabbitMQ exchange
Plugs are awesome
Ecto rocks
Invest on training
Erick Camacho @ecamacho