algorand / indexer

searchable history and current state
MIT License
114 stars 92 forks source link

Indexer Lag in Dev Mode #1613

Open gmalouf opened 6 months ago

gmalouf commented 6 months ago

"The behaviour I'm seeing is that intermittently, but consistently (multiple times every test run) indexer will wait for about 17s (almost exactly) until the transaction that's being waited for appears. The rest of the time it will happily appear sub-second. This makes me think there some sort of deadlock or delay somewhere."

Quoting @robdmoore:

I've recently found that there is an intermittent, but consistently occurring and significant performance issue with indexer when running the automated tests for https://github.com/algorandfoundation/algokit-subscriber-ts.

There are some tests in that library that use the following function in a series of tests (e.g. filters.spec.ts and events.spec.ts): https://github.com/algorandfoundation/algokit-subscriber-ts/blob/main/tests/filterFixture.ts#L29. Namely the call to waitForIndexerTransaction.

This method is defined in algokit-utils here: https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/testing/fixtures/algorand-fixture.ts#L122 and consists of these two underlying methods: https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/testing/indexer.ts#L12 and https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/indexer-lookup.ts#L20.

The behaviour I'm seeing is that intermittently, but consistently (multiple times every test run) indexer will wait for about 17s (almost exactly) until the transaction that's being waited for appears. The rest of the time it will happily appear sub-second. This makes me think there some sort of deadlock or delay somewhere.

I've looked at logs in algod, conduit, indexer and postgres and attached a profiler of sorts of postgres, but haven't seen anything conclusive yet.

Two things I have found:

Originally posted by @robdmoore in #1457

robdmoore commented 6 months ago

Thanks Gary