Skip to content
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

[Processor] Use multiple threads to speed up FA processor. #460

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Conversation

grao1991
Copy link
Contributor

@grao1991 grao1991 commented Jul 13, 2024

Most part of this PR is just from auto-formatter.

This PR is trying to use rayon to process transactions in multiple threads. I moved all the hashmaps inside the loop (so assumption here is everything txn can be processed independently), and produces per txn output. The output is merged together at the very end.

The performance improvement depends on the machine spec. On my dev machine processing p2p transfer data is 10x+ faster.

@grao1991 grao1991 requested a review from rtso August 15, 2024 01:38
@grao1991 grao1991 marked this pull request as ready for review August 15, 2024 01:38
@rtso rtso requested review from yuunlimm and a team August 16, 2024 23:22
Comment on lines +763 to +768
for (faa, fab, acs, cfab, fam) in data {
fungible_asset_activities.extend(faa);
fungible_asset_balances.extend(fab);
all_coin_supply.extend(acs);
current_fungible_asset_balances.extend(cfab);
fungible_asset_metadata.extend(fam);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this necessary?

Copy link
Contributor Author

@grao1991 grao1991 Aug 16, 2024

Choose a reason for hiding this comment

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

I don't want to change the insert_to_db interface for now, today we want to give it a larger batch to get better performance.

@grao1991 grao1991 requested a review from rtso August 16, 2024 23:47
@grao1991 grao1991 merged commit 66fa26c into main Aug 21, 2024
6 of 7 checks passed
@grao1991 grao1991 deleted the grao_fa branch August 21, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants