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

Fix timeout and concurrency layer #51

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Conversation

mi-yu
Copy link

@mi-yu mi-yu commented Jan 3, 2024

Demo locally running with --max-connections 5 and sending 20 requests in parallel, only 5 are executed at a time

https://www.loom.com/share/5cd4044c5f244b6780820a4f646db6de

.route_layer(TimeoutLayer::new(Duration::from_secs(self.timeout.unwrap_or(30))))
.route_layer(
ConcurrencyLimitLayer::new(
self.max_connections.unwrap_or(1024),
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for 1024? If so a comment would be nice

Copy link
Author

Choose a reason for hiding this comment

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

don't have a very concrete reason, just from the past we have only really seen 10 qps from the api side

@@ -295,7 +309,6 @@ impl Server {
.allow_origin(Any),
)
.layer(CompressionLayer::new())
.layer(TimeoutLayer::new(Duration::from_secs(self.timeout.unwrap_or(30))))

Choose a reason for hiding this comment

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

curious: why didn't this work?

Copy link
Author

Choose a reason for hiding this comment

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

not totally sure, I suspect that the very slow requests we saw were partially due to no concurrency limit, so there were just too many threads spawned and the timeout didn't trigger at the expected time

Copy link
Author

Choose a reason for hiding this comment

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

I was able to see timeout (408 status) locally when picking a very low timeout, so it is definitely configured correctly

@mi-yu mi-yu merged commit 2dfbff6 into dev Jan 3, 2024
5 checks passed
@mi-yu mi-yu deleted the miyu/fix-timeout-concurrency branch January 3, 2024 18:56
mi-yu added a commit that referenced this pull request Jan 9, 2024
mi-yu added a commit that referenced this pull request Mar 11, 2024
mi-yu added a commit that referenced this pull request Mar 12, 2024
* Add kafka feature and stream

* Suppress brc20 sats logs (#33)

* Suppress brc20 sats logs

* update comment

* optimized palindrome generation (#34)

* Fix content type (#35)

* Fix content type

* Bump version

* Add dev branch to CI

* Fix tests (#38)

* add cache to store old owner for stream event (#43)

* [ord] Remove block time again..... (#48)

* [ord] Remove block time again.....

* Fix lint

* fix lint again

* Skip pending check when listing sat ranges (#49)

* skip more events (#50)

* Fix timeout and concurrency layer (#51)

* Fix tests

* Update to v9 message (#53)

* Fix old owner cache key (#54)

* Add charms to StreamEvent (#55)

* 7 more types of rare sats (#57)

* 3 more types of rare sats

* format

* 4 more rarities

* fix ut

* exclude end sat from palindrome scanning

* block286 (#58)

* New rare sats (#59)

* new rare sats

* fix lint

* fix lint

* rename blocks_in_if_conditions to blocks_in_conditions

* disable taproot from rpc (#60)

* Merge consecutive hitman ranges within same block (#61)

* merge consecutive hitman ranges within same block

* change array size

* Fix tests

* Update to v10 message

---------

Co-authored-by: Rex <rex@magiceden.io>
Co-authored-by: haozhiliu <136628919+haozhiliu@users.noreply.github.com>
Co-authored-by: Zhuojie Zhou | rex <89176731+nothing0012@users.noreply.github.com>
Co-authored-by: Destiny Chen <110491217+destinymagicchen@users.noreply.github.com>
mi-yu added a commit that referenced this pull request Mar 12, 2024
mi-yu pushed a commit that referenced this pull request Jul 4, 2024
Suppress brc20 sats logs (#33)

* Suppress brc20 sats logs

* update comment

optimized palindrome generation (#34)

Fix content type (#35)

* Fix content type

* Bump version

Add dev branch to CI

Fix tests (#38)

add cache to store old owner for stream event (#43)

[ord] Remove block time again..... (#48)

* [ord] Remove block time again.....

* Fix lint

* fix lint again

Skip pending check when listing sat ranges (#49)

skip more events (#50)

Fix timeout and concurrency layer (#51)

Fix tests

Update to v9 message (#53)

Fix old owner cache key (#54)

Add charms to StreamEvent (#55)

7 more types of rare sats (#57)

* 3 more types of rare sats

* format

* 4 more rarities

* fix ut

* exclude end sat from palindrome scanning

block286 (#58)

New rare sats (#59)

* new rare sats

* fix lint

* fix lint

* rename blocks_in_if_conditions to blocks_in_conditions

disable taproot from rpc (#60)

Merge consecutive hitman ranges within same block (#61)

* merge consecutive hitman ranges within same block

* change array size

Fix tests

Update to v10 message

Add delegate field
@mi-yu mi-yu mentioned this pull request Jul 4, 2024
mi-yu pushed a commit that referenced this pull request Jul 4, 2024
Suppress brc20 sats logs (#33)

* Suppress brc20 sats logs

* update comment

optimized palindrome generation (#34)

Fix content type (#35)

* Fix content type

* Bump version

Add dev branch to CI

Fix tests (#38)

add cache to store old owner for stream event (#43)

[ord] Remove block time again..... (#48)

* [ord] Remove block time again.....

* Fix lint

* fix lint again

Skip pending check when listing sat ranges (#49)

skip more events (#50)

Fix timeout and concurrency layer (#51)

Fix tests

Update to v9 message (#53)

Fix old owner cache key (#54)

Add charms to StreamEvent (#55)

7 more types of rare sats (#57)

* 3 more types of rare sats

* format

* 4 more rarities

* fix ut

* exclude end sat from palindrome scanning

block286 (#58)

New rare sats (#59)

* new rare sats

* fix lint

* fix lint

* rename blocks_in_if_conditions to blocks_in_conditions

disable taproot from rpc (#60)

Merge consecutive hitman ranges within same block (#61)

* merge consecutive hitman ranges within same block

* change array size

Fix tests

Update to v10 message

Add delegate field
mi-yu pushed a commit that referenced this pull request Jul 4, 2024
Suppress brc20 sats logs (#33)

* Suppress brc20 sats logs

* update comment

optimized palindrome generation (#34)

Fix content type (#35)

* Fix content type

* Bump version

Add dev branch to CI

Fix tests (#38)

add cache to store old owner for stream event (#43)

[ord] Remove block time again..... (#48)

* [ord] Remove block time again.....

* Fix lint

* fix lint again

Skip pending check when listing sat ranges (#49)

skip more events (#50)

Fix timeout and concurrency layer (#51)

Fix tests

Update to v9 message (#53)

Fix old owner cache key (#54)

Add charms to StreamEvent (#55)

7 more types of rare sats (#57)

* 3 more types of rare sats

* format

* 4 more rarities

* fix ut

* exclude end sat from palindrome scanning

block286 (#58)

New rare sats (#59)

* new rare sats

* fix lint

* fix lint

* rename blocks_in_if_conditions to blocks_in_conditions

disable taproot from rpc (#60)

Merge consecutive hitman ranges within same block (#61)

* merge consecutive hitman ranges within same block

* change array size

Fix tests

Update to v10 message

Add delegate field
mi-yu pushed a commit that referenced this pull request Jul 4, 2024
Suppress brc20 sats logs (#33)

* Suppress brc20 sats logs

* update comment

optimized palindrome generation (#34)

Fix content type (#35)

* Fix content type

* Bump version

Add dev branch to CI

Fix tests (#38)

add cache to store old owner for stream event (#43)

[ord] Remove block time again..... (#48)

* [ord] Remove block time again.....

* Fix lint

* fix lint again

Skip pending check when listing sat ranges (#49)

skip more events (#50)

Fix timeout and concurrency layer (#51)

Fix tests

Update to v9 message (#53)

Fix old owner cache key (#54)

Add charms to StreamEvent (#55)

7 more types of rare sats (#57)

* 3 more types of rare sats

* format

* 4 more rarities

* fix ut

* exclude end sat from palindrome scanning

block286 (#58)

New rare sats (#59)

* new rare sats

* fix lint

* fix lint

* rename blocks_in_if_conditions to blocks_in_conditions

disable taproot from rpc (#60)

Merge consecutive hitman ranges within same block (#61)

* merge consecutive hitman ranges within same block

* change array size

Fix tests

Update to v10 message

Add delegate field
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.

3 participants