Hi, I’m testing out adding Phoenix into our mix at work, and am starting off by having it do some read services for our move from a big monolith to a more distributed CQRS set of services. So at first all it’s going to be doing is returning a pre-rendered json payload, stored in a materialized view. In order to justify bringing Elixir to our stack, I need to come up with some numbers, so I’m planning on load testing various options for our read services. My question is: what’s the minimum sensible deployment for this simple app such that when I load test it, I’m getting realistic numbers? We deploy on EC2 instances on AWS, and the read cache is in MySQL for now.
You might not need a lot of stuff. You can configure Phoenix to fit your use-case.
You would get all parameters with
$ mix help phx.new
For a JSON Api, I would use
$ mix phx.new my_project --no-html --no-brunch --database mysql
For optimisation I would try to replace Poison with Jason.
For deployement I would add
I don’t think You need more than this… Maybe Httpoison if You plan to get your data over http/s.
If you don’t want to use
Phoenix you can start with a new mix project and use only
Thanks for the input. Can anyone shed more light on what the minimal proper way to be serving it is on the server? In my case the service will only be hit from an API gateway service, so I don’t need sessions or authentication or anything, it will be locked down on a private network.
As I said if you don’t need sessions or authentication start with
Cowboy and you’'ll have a minimal setup. You can start with an empty project:
mix new my_project and then add those libraries to mix.exs
And so does --no-html with phx generator. It does not use the browser pipeline, but the api one. It does not activate session, authentication too.
You might go the cowboy way. If You need also websocket support, then You might choose Phoenix instead.
What have you tried so far?
The only thing I’ve tried so far is serving the app using mix phx.server. As I have no assets to bundle or serve differently, maybe that’s sufficient? What I want to avoid is getting bunk data from my load test comparison because I tested the elixir process with it “deployed wrong”, so it’s a bit of a case of me not knowing what I don’t know. I looked over the phoenix doc deployment pages, but they seems slanted at deployments for much for involved sites (or maybe I’m just wrong!)
Is simply installing on a small EC2 box and making an ubuntu service that fires up “mix phx.server” and acceptable and realistic way of serving on a simple site?
For testing your usecase it’s probably ok to start
mix phx.server, but for production you should always use proper mechanisms that also blend into your processes.
Also in general destillery is nice in this regard, as you can build self contained archives with it. You then do not need to install Erlang and elixir on your server, but only drop the release and run it.