vladnec

vladnec

Configuring a Single Flame Runner Across Multiple Deployment Instances

Hello all,

I’ve configured the following setup in application.ex :

    {FLAME.Pool,
       name: Nexus.HTMLToPDFRunner,
       min: 1,
       max: 10,
       max_concurrency: 5,
       idle_shutdown_after: 10_000,
       log: :debug}

But, my application is deployed across multiple instances (fly scale count 3). As a result, I end up with 3 instances of the flame runner instead of the single one I intended to have.

Does anyone have insights on how to configure this so that I only get one flame runner, regardless of the number of deployed instances?

Most Liked

slouchpie

slouchpie

You can totally do this. You can have a global singleton which is your FLAME pool. For example, using :pogo:

  1. Remove FLAME.Pool from your application children.

  2. Add Pogo supervisor to your application children (check the pogo docs). Let’s say you called it MyApp.DistributedSueprvisor

  3. Start your global singleton FLAME pool supervisor like this:

    Pogo.DynamicSupervisor.start_child(
        MyApp.DistributedSupervisor,
        FLAME.Pool.child_spec(
          name: MyApp.FlamePool,
          min: 20,
          max: 30,
          max_concurrency: 10,
          idle_shutdown_after: 2 * 60 * 60 * 1_000,
          min_idle_shutdown_after: 2 * 60 * 60 * 1_000,
          timeout: 5_000
        )
      )

Pogo will ensure unique children IDs. Flame will set the ID to be some kind of tuple like {FLAME.Pool, MyApp.FlamePool} (it uses the name opt). So if you are using the pogo supervisor which_children function, watch out for that.

Do not copy my Flame config! Decide your own values. This is just a concept BTW. I am not recommending you use a single flame supervisor on just one node. It seems at odds with the spirit of FLAME.

Last Post!

NduatiK

NduatiK

I agree with you, I meant that the code shows that for each instance the number of min workers is managed locally, without considering whether workers exist on other instances.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
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

We're in Beta

About us Mission Statement