Hi all, I’m hoping to sanity check with the community here whether choosing Elixir/Phoenix for my a single man start up project makes reasonable sense.
I’m looking to write an Elixir API backend to support a mobile app. It’s nothing fancy; just a bunch of CRUD work. I have a lot of experience doing this kind of work in Ruby/Rails but doing it in Elixir/Phoenix will be my first.
One of my gripes with Ruby happens to be with things like OAuth where you are trying to exchange auth code for a token inside of a Rails request. Doing this forces Rails to start queuing other requests leading to APDEX reduction.
I’m not saying Ruby is bad and I’m aware of the different strategies that avoids this but my point is out of the box this isn’t a simple thing to do in Ruby. It seems to me that Elixir can handle this pretty nicely since Phoenix kicks off a new process per request and the lightweight nature of them means if they take 10 seconds to complete, the rest of the app will continue to service requests just fine when in Ruby/Rails service will quickly become slow with a few more requests.
Additionally, I’m poor and don’t want to throw a lot of cash to buy a beefy hosting environment. So the thinking is to run Elixirs on an economical hosting environment such as a $5 droplet. Obviously hosting resources are finite and the beefiest of them can reach capacity under enough load but that’s unlikely for what this is and if I see a lot of traffic that would be an indication of success and a cue for more investment.
Anyway, I’m curious to hear what problems one should anticipate when running Phoenix apps (Dockerised) on a modest hosting environment?
As always - IO congestion. In most cases the CPU shouldn’t be a problem, and if so, it is quite easy to scale vertically that (to the extent), but when you hit IO boundary, then a little can be done except scaling horizontally.
If that would be me, then I would try to drop Docker from the equation if possible, as you can achieve almost everything it provides much easier without all of Docker fuss (like server-client architecture).
With Elixir/Phoenix you will get more performance out of the box. This is almost guaranteed.
But, the question is how good you are in Elixir compared to Ruby and if you are willing to spend time on learning along the way. If you have 10 years of Ruby experience and you want to get something running fast, then by all means take Ruby. Your problem just sounds like you need to spawn more workers for your server, or get a server for 10$ instead fo 5. What is more important? Keep costs to a minimum but increase development time, or iterate fast but have higher cost?
About Docker - from my experience, at work and for my own pet projects I am running apps in docker containers and don’t experience any problems at all. On the opposite - I have less problems I think. But the initial setup and knowledge also has a time cost.
I have to agree with @egze. As a single developer most projects are easy to scale server-side and your biggest cost factor is your own time. From my own experience it takes at least a month to get up to speed with Elixir/Phoenix coming from Rails - and even longer to make good use of OTP etc in production.
In general, I find development of new projects is faster in Ruby because there are more Gems available and Rails provides many features out of the box. Phoenix tends to be easier to maintain, but I rarely miss any of its particular strenghts when building CRUD apps or MVPs. Both languages and their frameworks are great tools.
Stick to Rails if time and funds are limited, give Elixir/Phoenix a try if you want to learn a fun language that comes with a different paradigm (functional programming).
To echo most of what has been said here:
You are going to get much better performance and maintenance costs (those paid with your own time) with Elixir and Phoenix. And Pow’s plugins allow for OAuth relatively effortlessly. You should be up and running rather quickly.
…IF you have learned Elixir well beforehand.
Elixir, and functional programming in general, tend to pay off dividends in the future and in the longer term – and not right now.
If you are a single dev startup and are looking to get to market with the maximum speed possible, stick to what you know. If you are not in a rush and want your future self to thank your past self, definitely pick an FP language like Elixir and then the Phoenix web framework – it saves a lot of headaches after you overcome the initial big time and effort investment to learn.