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.

Where Next?

Popular in Questions Top

jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
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
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
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
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
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
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement