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

refactor(SQS): switch to a more performant JSON lib #7065

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

p0mvn
Copy link
Member

@p0mvn p0mvn commented Dec 11, 2023

Closes: #XXX

What is the purpose of the change

Based on profiling, JSON unmarshaling is a big bottleneck in SQS. Accordingly, we switch the library to a more performant one - https://github.com/json-iterator/go

Based on the new profile, the overall share of the unmarshaling is not as large as before.

Additionally, load testing shows an improvement.

Old load testing:
image

New load testing:
image

Old profile (incomplete):
image

New profile:
image

Testing and Verifying

This change is already covered by existing tests, such as (please describe tests).

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

@p0mvn p0mvn changed the title refactor(SQS): switch to a more performant t JSON lib refactor(SQS): switch to a more performant JSON lib Dec 11, 2023
@p0mvn p0mvn added A:no-changelog V:state/compatible/no_backport State machine compatible PR, depends on prior breaks labels Dec 11, 2023
@p0mvn p0mvn marked this pull request as ready for review December 11, 2023 03:04
@ValarDragon
Copy link
Member

NIce job! If we want to completely eliminate this time, we can also switch to using one of the JSON libs that code-gens deserialization logic. (So it all stays on stack, no reflection/runtime tricks, and minimal heap allocation. This is where all time goes in traditional unmarshalling)

@ValarDragon
Copy link
Member

Should we make an issue to use this in the SDK for import/export genesis?

@ValarDragon ValarDragon merged commit 6506d0d into main Dec 11, 2023
@ValarDragon ValarDragon deleted the roman/sqs-json-lib branch December 11, 2023 12:30
@p0mvn p0mvn added V:state/compatible/backport State machine compatible PR, should be backported A:backport/v20.x backport patches to v20.x branch A:backport/v21.x backport patches to v21.x branch and removed V:state/compatible/no_backport State machine compatible PR, depends on prior breaks labels Dec 11, 2023
mergify bot pushed a commit that referenced this pull request Dec 11, 2023
* refactor(SQS): switch to a more performant t JSON lib

* godoc

(cherry picked from commit 6506d0d)

# Conflicts:
#	go.mod
#	ingest/sqs/chain_info/repository/redis/redis_chain_info_repository.go
#	ingest/sqs/domain/router.go
#	ingest/sqs/pools/repository/redis/redis_pools_repository.go
#	ingest/sqs/router/repository/redis/redis_router_repository.go
#	ingest/sqs/router/usecase/routertesting/parsing/mainnet_pools.go
#	ingest/sqs/router/usecase/routertesting/parsing/mainnet_pools_test.go
#	ingest/sqs/system/delivery/http/system_http_handler.go
#	ingest/sqs/tokens/usecase/tokens_usecase.go
mergify bot pushed a commit that referenced this pull request Dec 11, 2023
* refactor(SQS): switch to a more performant t JSON lib

* godoc

(cherry picked from commit 6506d0d)
ValarDragon pushed a commit that referenced this pull request Dec 11, 2023
* refactor(SQS): switch to a more performant t JSON lib

* godoc

(cherry picked from commit 6506d0d)

Co-authored-by: Roman <[email protected]>
@p0mvn
Copy link
Member Author

p0mvn commented Dec 12, 2023

Should we make an issue to use this in the SDK for import/export genesis?

cosmos/cosmos-sdk#18704

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v20.x backport patches to v20.x branch A:backport/v21.x backport patches to v21.x branch A:no-changelog V:state/compatible/backport State machine compatible PR, should be backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants