Skip to content

Commit

Permalink
perf: scaled partitioning of registries (#2130)
Browse files Browse the repository at this point in the history
* chore: fix flaky schema check

* Revert "fix: reduce exit trapping and error logging on supervision tree termination"

This reverts commit e2fb447.

* chore: resolve flaky tests, remove unnecessary exit trapping

* perf: scaled partitioning of registries
  • Loading branch information
Ziinc authored Jul 10, 2024
1 parent 3a4489d commit eb78803
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/logflare/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions lib/logflare/backends/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit eb78803

Please sign in to comment.