tadasajon

tadasajon

How does Fly.io work? Isn't the database the performance botleneck?

The consensus in the elixir community seems to be that Fly.io is the way to deploy Phoenix apps, and I have successfully done this myself, but I don’t understand how it works.

The docs state:

We want you to run your full stack close to users, whether it’s a simple web service or your database-backed opus with multiple supporting services.

But what if I have users all over the world? Does Fly.io constantly move my app around to be close to different users? What about the database – certainly it should be the single source of truth, so I don’t see how it can be moved easily.

What does Fly.io offer that is different from just picking a datacenter in some location that you think will be close to the majority of your users and just deploying your app there?

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

I think Fly is doing great stuff, and I think they’re a great default for deployment. That said, I think there’s still a LOT of us deploying Phoenix in more traditional cloud environments, or in even more traditional servers. Fly is definitely not the majority of deployments, and I would be surprised if they were a plurality.

I am not a Fly expert, but my sense is that they help in two ways:

  1. LiveView in particular adds client → server round trips for rendering that often do not hit the database. These are helped by having the app closer to the client.
  2. Fly has global replicas for postgres, which basically let you have read replicas colocated near your apps near your users at the edge. This doesn’t help writes, but it definitely cuts down on latencies for reads.
gregvaughn

gregvaughn

Look up Mark Ericksen’s talk at last year’s ElixirConf for more details. It’s some clever stuff.

sorentwo

sorentwo

Oban Core Team

From polls, conversations, and a lot of support I can confidently say elixir apps are deployed all over the place: GCP, AWS, Heroku, Render, Gigalixir, Hetzner, and Fly come up regularly (though Gifalixir and Heroku are declining).

LostKobrakai

LostKobrakai

Do add to that: Fly enables you to be closer to your users, but it doesn’t come for free, but as options you need to use.

  1. The first option is scaling your app server across multiple regions. That can be done on other hosts as well and while it is simple on fly I wouldn’t call that something you won’t or can’t see elsewhere.
  2. The second option is scaling your db across regions as read replicas, where you’d still stick to a single writeable instance. Fly uses the first point as the underlying infrastructure for their managed databases. On top there are a few well thought out conventions to let their hosted db setup be rather hands off for the db scaling side and also provide some comparatively simple means of making your app ready for such a setup as well. This again can probably be done elsewhere as well, though I haven’t seen all of those points be combined that well.
tadasajon

tadasajon

Fly is definitely not the majority of deployments, and I would be surprised if they were a plurality.

What deployment solution would you guess accounts for the plurality of deployments?

Where Next?

Popular in Questions Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement