Skip to content

Conversation

@tolikzinovyev
Copy link
Contributor

Summary

This significantly simplifies the code in Indexer, and paves a way to querying asset/app creators in a batch.

Test Plan

New tests for batch querying of asset/app creators.

@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2021

Codecov Report

Merging #652 (73b55f2) into develop (0438a91) will increase coverage by 0.12%.
The diff coverage is 88.63%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #652      +/-   ##
===========================================
+ Coverage    51.85%   51.98%   +0.12%     
===========================================
  Files           23       23              
  Lines         3560     3557       -3     
===========================================
+ Hits          1846     1849       +3     
+ Misses        1462     1457       -5     
+ Partials       252      251       -1     
Impacted Files Coverage Δ
...ernal/ledger_for_evaluator/ledger_for_evaluator.go 66.66% <88.09%> (+1.99%) ⬆️
idb/postgres/postgres.go 46.37% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0438a91...73b55f2. Read the comment docs.

@tolikzinovyev tolikzinovyev force-pushed the tolik/batching-refactor branch from 6b42753 to a75ebfc Compare September 22, 2021 19:12
@tolikzinovyev
Copy link
Contributor Author

I think we can now update go-algorand.

@tolikzinovyev tolikzinovyev marked this pull request as ready for review September 22, 2021 19:15
@tsachiherman
Copy link
Contributor

I think we can now update go-algorand.

are you referring to the changes in algorand/go-algorand#2846 ?

@tolikzinovyev
Copy link
Contributor Author

No, we were pointing go-algorand to its release branch. Now that we have released a beta Indexer, we can point go-algorand to master again.

@tolikzinovyev tolikzinovyev force-pushed the tolik/batching-refactor branch 2 times, most recently from b8357e6 to 8249f39 Compare October 4, 2021 21:36
@tolikzinovyev tolikzinovyev force-pushed the tolik/batching-refactor branch from 8249f39 to 4e3a284 Compare October 6, 2021 17:14
Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just had a couple questions.

}
return accountData, round, nil
// GetAssetCreator is part of go-algorand's indexerLedgerForEval interface.
func (l LedgerForEvaluator) GetAssetCreator(indices map[basics.AssetIndex]struct{}) (map[basics.AssetIndex]ledger.FoundAddress, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there any thought about organizing this so that it could be batched along with the account lookup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be done, but a couple of additional RTTs do not make a difference for amazon aurora if we want to optimize TPS. The RTT is < 1ms, so for large blocks it is negligible. However, if we also want to optimize the catchup time, we should revisit this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the query duration? Sounds like the RTT isn't really a factor, but running each of these in parallel could have some value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we can influence parallelism and gain performance. One thing that comes to mind is read requests going to different read replicas of aurora can help, but we don't have control over it, and I'm not sure the load balancer is smart enough. In addition, other databases (regular postgres) might have worse performance because of parallelism (one thing that comes to mind is HDD where parallel reading causes too many head jumps so the overall performance is worse, not sure how it works for SSD). Also, if we want to parallelize, we should start with parallelizing account query from the account table, as that is longest part of reading data.

return fmt.Errorf(
"AddBlock() cannot find proto version %s", block.BlockHeader.CurrentProtocol)
}
proto.EnableAssetCloseAmount = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think things like this could move into algod also?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a good reason. What about you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason would be to keep consensus param "magic" as close to the source as possible. If we have an interface in algod designed for Indexer, shouldn't we use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion. @tsachiherman maybe does.

@tolikzinovyev
Copy link
Contributor Author

Thanks for review!

@tolikzinovyev tolikzinovyev merged commit 293ce68 into develop Oct 18, 2021
@tolikzinovyev tolikzinovyev deleted the tolik/batching-refactor branch October 18, 2021 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants