diff --git a/lib/logflare/application.ex b/lib/logflare/application.ex index 0950d3cc4..67e63e111 100644 --- a/lib/logflare/application.ex +++ b/lib/logflare/application.ex @@ -63,7 +63,9 @@ defmodule Logflare.Application do Logflare.Repo, Logflare.Backends, {Registry, - name: Logflare.V1SourceRegistry, keys: :unique, partitions: System.schedulers_online()}, + name: Logflare.V1SourceRegistry, + keys: :unique, + partitions: max(round(System.schedulers_online() / 8), 1)}, {Task.Supervisor, name: Logflare.TaskSupervisor}, {DynamicSupervisor, strategy: :one_for_one, name: Logflare.Endpoints.Cache}, {DynamicSupervisor, @@ -133,7 +135,9 @@ defmodule Logflare.Application do # Sources # v1 ingest pipline {Registry, - name: Logflare.V1SourceRegistry, keys: :unique, partitions: System.schedulers_online()}, + name: Logflare.V1SourceRegistry, + keys: :unique, + partitions: max(round(System.schedulers_online() / 8), 1)}, Logs.RejectedLogEvents, # init Counters before Supervisof as Supervisor calls Counters through table create Counters, diff --git a/lib/logflare/backends/supervisor.ex b/lib/logflare/backends/supervisor.ex index 1aefc7095..35d006853 100644 --- a/lib/logflare/backends/supervisor.ex +++ b/lib/logflare/backends/supervisor.ex @@ -13,14 +13,18 @@ defmodule Logflare.Backends.Supervisor do @impl Supervisor def init(_) do + base = System.schedulers_online() + children = [ Backends.IngestEventQueue, Backends.IngestEventQueue.BroadcastWorker, Backends.IngestEventQueue.MapperJanitor, Backends.Adaptor.PostgresAdaptor.Supervisor, {DynamicSupervisor, strategy: :one_for_one, name: Backends.SourcesSup}, - {Registry, name: Backends.SourceRegistry, keys: :unique}, - {Registry, name: Backends.BackendRegistry, keys: :unique} + {Registry, + name: Backends.SourceRegistry, keys: :unique, partitions: max(round(base / 8), 1)}, + {Registry, + name: Backends.BackendRegistry, keys: :unique, partitions: max(round(base / 8), 1)} ] opts = [strategy: :one_for_one]