-
Notifications
You must be signed in to change notification settings - Fork 17
perf(ensv2): address label-heal and DB-lookup hotspots #1989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
ef8a9c3
16abf3d
e6523a1
1895a9b
6ae1f92
aba0e5b
9a114e5
7e480ac
55a0916
c8f9c57
2ae4867
638bdc5
0726714
5c1b621
a067a75
88edd41
578b898
8301161
fb3639b
543dc1e
5358b12
03a55a2
e9f0d5d
501f718
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ import { | |
| import { type EncodedReferrer, PluginName, toJson } from "@ensnode/ensnode-sdk"; | ||
|
|
||
| import { ensureDomainEvent } from "@/lib/ensv2/event-db-helpers"; | ||
| import { ensureLabel, ensureUnknownLabel } from "@/lib/ensv2/label-db-helpers"; | ||
| import { ensureLabel, ensureUnknownLabel, labelExists } from "@/lib/ensv2/label-db-helpers"; | ||
| import { getLatestRegistration, getLatestRenewal } from "@/lib/ensv2/registration-db-helpers"; | ||
| import { getThisAccountId } from "@/lib/get-this-account-id"; | ||
| import { | ||
|
|
@@ -63,11 +63,13 @@ export default function () { | |
| ); | ||
| } | ||
|
|
||
| // ensure label | ||
| // if the contract emitted a healed label, ensure that it is indexed | ||
| if (label !== undefined) { | ||
| await ensureLabel(context, label); | ||
| } else { | ||
| await ensureUnknownLabel(context, labelHash); | ||
| // otherwise, attempt a heal if not exists | ||
| const exists = await labelExists(context, labelHash); | ||
| if (!exists) await ensureUnknownLabel(context, labelHash); | ||
| } | ||
|
|
||
| // update registration's base/premium | ||
|
|
@@ -103,12 +105,13 @@ export default function () { | |
| ); | ||
|
Comment on lines
101
to
105
|
||
| } | ||
|
|
||
| // ensure label | ||
| // NOTE: technically not necessary, as should be ensured by NameRegistered, but we include here anyway | ||
| // if the contract emitted a healed label, ensure that it is indexed | ||
| if (label !== undefined) { | ||
| await ensureLabel(context, label); | ||
| } else { | ||
| await ensureUnknownLabel(context, labelHash); | ||
| // otherwise, attempt a heal if not exists | ||
| const exists = await labelExists(context, labelHash); | ||
| if (!exists) await ensureUnknownLabel(context, labelHash); | ||
| } | ||
|
|
||
| const controller = getThisAccountId(context, event); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # @ensnode/ensindexer-perf-testing | ||
|
|
||
| Local Prometheus + Grafana bundle for benchmarking ENSIndexer throughput. | ||
|
|
||
| ## What's in the box | ||
|
|
||
| - **Prometheus** on `http://localhost:9090`, scraping `host.docker.internal:42069/metrics` every 5s (6h retention, admin API enabled). | ||
| - **Grafana** on `http://localhost:3001` (anonymous admin, no login) with a pre-provisioned Prometheus datasource and a **Ponder / ensindexer** dashboard. | ||
|
|
||
| Dashboard panels are tuned for indexer perf work: | ||
|
|
||
| - Top handlers by share of wall-clock time (`rate(ponder_indexing_function_duration_sum[1m]) / 1000`) | ||
| - Handler p95 duration (top 15) | ||
| - Events/sec per event and total | ||
| - Total events per handler (bar gauge) | ||
| - Synced block + historical blocks/sec per chain | ||
| - RPC req/s + p95 duration per chain/method | ||
| - Node event-loop lag p99, Postgres queue size, DB store queries/sec | ||
|
|
||
| ## Usage | ||
|
|
||
| From this package's directory: | ||
|
|
||
| ```bash | ||
| pnpm up # start prometheus + grafana | ||
| pnpm down # stop and remove containers | ||
| pnpm logs # tail container logs | ||
| pnpm wipe # purge prometheus series (useful between benchmark runs) | ||
| ``` | ||
|
|
||
| Then start the indexer in another terminal (`pnpm -F ensindexer dev`) and open the dashboard at <http://localhost:3001/d/ensindexer>. | ||
|
|
||
| The scrape target is `host.docker.internal:42069` — on macOS that resolves to the host via the `host-gateway` declaration in the compose file. On Linux hosts you may need Docker 20.10+ for the same behavior. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| services: | ||
| prometheus: | ||
| image: prom/prometheus:v2.55.1 | ||
| container_name: ensnode-prometheus | ||
| # bound to loopback to avoid exposing publicly | ||
| ports: | ||
| - "127.0.0.1:9090:9090" | ||
| volumes: | ||
| - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro | ||
| command: | ||
| - --config.file=/etc/prometheus/prometheus.yml | ||
| - --storage.tsdb.retention.time=6h | ||
| - --web.enable-admin-api | ||
|
shrugs marked this conversation as resolved.
|
||
| extra_hosts: | ||
| - "host.docker.internal:host-gateway" | ||
|
|
||
| grafana: | ||
| image: grafana/grafana:11.3.0 | ||
| container_name: ensnode-grafana | ||
| # bound to loopback to avoid exposing publicly | ||
| ports: | ||
| - "127.0.0.1:3001:3000" | ||
| environment: | ||
| GF_AUTH_ANONYMOUS_ENABLED: "true" | ||
| GF_AUTH_ANONYMOUS_ORG_ROLE: Admin | ||
| GF_AUTH_DISABLE_LOGIN_FORM: "true" | ||
| volumes: | ||
| - ./grafana/provisioning:/etc/grafana/provisioning:ro | ||
| - ./grafana/dashboards:/var/lib/grafana/dashboards:ro | ||
| depends_on: | ||
| - prometheus | ||
Uh oh!
There was an error while loading. Please reload this page.