Why fly needs two machines for an app with services?

Hello Everyone, Good day! I wanted to ask a question about Fly.io that i didn’t understand. The question is why fly needs to deploy two machines for an app that has process group with “services”. Why does the services requires two app for functioning? In my case i am working with Elasticsearch container that has ports 9200 exposed. Can i just work with one machine?

It’s probably for reliability reasons, but if you don’t need two machines you can destroy one of them using the flyctl.

2 Likes

It’s for reliability reasons, especially when making updates to your app.

1 Like

Hi thanks a lot for your reply. So, as i understand when i have services in my application, they serve the requests they get from the internet, so to have a reliable connection, it needs two machines??

Having multiple instances of your application enhances reliability and reduces downtime. By distributing the workload across multiple instances, it prevents a single point of failure. If one instance fails, the others can still handle the requests, ensuring uninterrupted service and improving fault tolerance. Additionally, it enables load balancing, allowing efficient resource utilization and better scalability as the application demand grows.

It can also come in handy when doing something like blue-green deployment using Fly.

4 Likes

Thanks a lot… that explains completely.

Hi thanks a lot for your reply. Understood, have a good day!

1 Like

Hey guys, today i deployed my app with this command and this toml file, but this time even having the http_service the app deployed only one machine. That’s a bit confusing :sweat_smile::sweat_smile:. I’m sorry for all these questions but i really want to understand how things are working behind the scenes.
Deploy command:

flyctl deploy --vm-cpukind shared --vm-memory 2048

fly.toml file:

app = "elastic-search-container"
primary_region = "fra"

[build]

[http_service]
  internal_port = 9200
  force_https = true
  auto_stop_machines = false
  auto_start_machines = false
  min_machines_running = 0
  processes = ["app"]

[mounts]
  source="esdata01"
  destination="/usr/share/elasticsearch/data"

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.