Cost of Adding Phoenix

So I’ve proposed using Phoenix for our next project for its Presence feature which we need. However, theres a lot of pushback from the cost of adding another language/framework to our existing legacy Java/Rails stack. The pushback is mostly from codifying the provisioning and deployment of new servers, maintenance and debugging of deployment issues, ect. Our Rails stack is monolithic and the Java stack is being deprecated.

I always hear about random companies utilizing many different languages and frameworks where they feel it works best but I’ve never heard of considering not using a technology because of the cost of dev ops. While I understand there are real costs with adding anything new, has anyone heard of or run up against this kind of problem?

2 Likes

The monetary cost of the Elixir + Phoenix infrastructure will be (significantly) less, because a single server can generally serve a lot more users in parallel than e. g. a Rails server can. This has been used as an important argument to convince managers about the switch before.

The cost/effort needed to learn another ecosystem is of course another thing, which also needs to be taken into consideration. A major advantage of the BEAM is that many frameworks and libraries all exist within this system, so it usually is not necessary to ‘cop out’ to external databases, loggers, queuing, background process scheduling, etc. You may of course still do so (and many people like to still use an SQL database over, for instance, an ETS one) but there is less incentive to do so. This reduces the amount of application complexity.

Of course, in the shot term, you will have both your existing application and the new application running side-by-side, and they quite possibly need to communicate with each other. This is another thing to keep in mind.

I do remember that in the last episode of the Elixir Fountain a library which lets you gradually move over (API) routes from your current application to your new Elixir one. I think the best approach to switching to Elixir is to do it gradually in such a way. It allows everyone to get up to speed, and ensures that your new system still provides the functionality of the old. It also is less than a gamble than doing a full rewrite at once.

1 Like

I can speak from introducing Elixir/Phoenix at a Rails company so it might help :slight_smile:

From the coding side: As the overall structure of Phoenix is still fairly similar to Rails it’s rather easy to onboard developers on the application as they feel somewhat at home. Same with Elixir stdlib and Ruby stdlib. There was also some larger blog post describing a companies success with that, I can’t seem to find it…

Now the devops side - setting up the server is rather easy as technically you don’t even need Elixir/Phoenix there as you can build self contained releases and just push them there, even if you did they are super easy to install. In practice, we still have it there and build releases on a production server so that we don’t need to have the secrets somewhere else.

Setting up the real deployment was a bit more of a pain/learning curve for us - I think the initial one took ~2 days iirc. We use edeliver which is nice but dunno… just took some fiddling, learning and reading and debugging bash script errors. So it’s doable but (for me at least) the part where I’d still like to see the eco system improve.

Monitoring is up and coming, there are a few error tracking services that already support Elixir/Phoenix and you’ll find user made agents for many others. At the same time AppSignal has its beta for performance and error tracking and others will likely follow suit soon :slight_smile:

Additionally for convincing people, the good old Erlang argument with systems running forever without fault also works fairly well :slight_smile:

Overall, it went great for us. We use Phoenix - somewhat similar to you - mostly for the channels/websockets and it has been a good success for the team as a whole :slight_smile:

Hope that all helped somewhat!

4 Likes

Why would you need new servers? Unless you are already maxing out your servers you can run multiple apps/sites/languages on a single server.

On this server for example I’ve got multiple sites running a variety of languages/dbs:

PHP/Mysql
Rails/Postgres
Docker/Rails/Ember/
Plain Html/Css
Scheduled crons in Ruby
…soon - Elixir/Phoenix

1 Like

Do not tell this my companies customers :wink:

Onehost-systems are considered to scale badly. Also sometimes it is an security issue to have unrelated software on the same host. So I can understand the problems of the OP.

Anyway, on my windows system I do often use Vagrant and Puppet to fire up development machines powered by centOS 7. Writing the puppetfiles was straight forward. I think I will puplish that stuff at github over the weekend.

1 Like

Thanks a lot, this has been really helpful!

@AstonJ we aren’t planning on a replacement, but rather running side by side with the legacy stack, i.e. Making our Java/Rails stack into a Java/Rails/Elixir stack. Where it goes from there and if we replace Rails with Elixir is a battle for another day. As a general rule our dev ops team tends to try to keep a single service to a single box, which is much more attractive with a docker based infrastructure (still working towards that though).

@PragTob thanks for all the info and the recommendation of AppSignal! I’ll definitely check it out. For error monitoring I had previously started my own open source version https://github.com/mgwidmann/flames which works but is still very new. I was panning on using it if we can’t find a decent service that’s not too expensive.

1 Like

Not sure if this helps or not (since it’s in the Trial and not the Adopt ring):

1 Like

Just saying but with good containers (ie not linux ) you can have one server with multiple app without security issues. Just saying.

2 Likes

I like the name “flames” for the error monitoring. :laughing:

Can You point me in right direction what to look for? Not mocking or anything, simply want to know more, because i know nothing :slight_smile:

Thanks, I thought it was fitting!

1 Like

This is a good beginning. I would advise to have a look at smartOS/illumos stuff.

I have no idea if Jails finally got the good patch in freeBSD.

1 Like

Illumos/Solaris. It did containers right, years ago. It even has a linux container.

Do note, these are real containers, not VM’s (although it has a VM container too if you want to run Windows stuff or whatever).

Yup. I am going to try to find some time to play a bit with SmartOS and Joyent stuff around it in coming months/weeks, if some are interested. I think Elixir/erlang releases combined with proper use of SmartOS Zones may enable to get rid of most need for Docker in prod for Elixir stuff.

Of course it may never be used that much due to the fact it is not running on Linux but worth looking at.

Any idea if the patch for Jails, namely networking virtualisation securisation and al ever get merged upstream in FreeBSD?

1 Like