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?

First Post!

NduatiK

NduatiK

Hey @vladnec, I don’t have an answer to your question, but I think some more information might be useful.

Specifically, are your multiple instances clustered or do they just share a DB? Without clustering, I’m not sure how Flame on one instance would know that another instance has a runner.

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

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
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

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42716 114
New

We're in Beta

About us Mission Statement