curiosum-dev / kanta

User-friendly translations manager for Elixir/Phoenix projects.
https://kanta.curiosum.com/kanta/dashboard
MIT License
182 stars 15 forks source link

Slow Response Times When Deploying Across Multiple Regions with Kanta Active #55

Open vladnec opened 8 months ago

vladnec commented 8 months ago

We are experiencing significant latency issues with our Elixir application deployed on Fly.io, particularly when deploying across multiple regions (Frankfurt and London) with Kanta activated. The response time deteriorates from 0.2 seconds to more than 5 seconds under these conditions.

Configuration Details Below are the relevant parts of our configuration, highlighting the setup for Kanta and the application's supervision tree.

Here is my configuration:

config.exs

config :nexus, Kanta,
  endpoint: NexusWeb.Endpoint,
  repo: Nexus.Repo.Local,
  otp_name: :nexus,
  plugins: []

prod.exs

config :nexus, gettext_repo: Kanta.Gettext.Repo

application.ex

def start(_type, _args) do
    children = [
       ....
       {Kanta, Application.fetch_env!(:nexus, Kanta)},
       ...
     ]
    opts = [strategy: :one_for_one, name: Nexus.Supervisor]
    Supervisor.start_link(children, opts)
end

lib/nexus_web/gettext

defmodule NexusWeb.Gettext do
  use Gettext,
    otp_app: :nexus,
    repo: Application.compile_env(:nexus, :gettext_repo)
end

Additional Information This issue might be related to Fly.Postgres, considering the multi-region deployment aspect. We have not observed any relevant logs that directly point to the cause of the latency.

Do you know what the exact problem might be and what could we do to try and find a solution?

thanks.