-
Notifications
You must be signed in to change notification settings - Fork 87
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] Issue #709: do not enqueue all responses #713
Open
ckeshava
wants to merge
9
commits into
XRPLF:main
Choose a base branch
from
ckeshava:asyncio-queue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b3ce986
[FIX] Issue #709: do not enqueue all responses
ckeshava 444f14b
use asyncio.gather to concurrently fund wallets for xchain tests
ckeshava 24df937
Revert "use asyncio.gather to concurrently fund wallets for xchain te…
ckeshava d2f9dfc
Merge branch 'main' into asyncio-queue
ckeshava c4b35c1
integration tests to measure the memory growth of Websocket clients -…
ckeshava f3597bc
improve wording of the comments
ckeshava 88b0428
address PR comment: remove comment
ckeshava 3a53ffc
use async_and_sync construct for running the integ tests
ckeshava 8617377
Merge branch 'main' into asyncio-queue
ckeshava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Performance testing of Websocket clients.""" | ||
|
||
from __future__ import annotations | ||
|
||
from tests.integration.integration_test_case import IntegrationTestCase | ||
from tests.integration.it_utils import test_async_and_sync | ||
from xrpl.models.currencies import XRP, IssuedCurrency | ||
from xrpl.models.requests import BookOffers | ||
from xrpl.models.response import ResponseStatus | ||
|
||
|
||
class TestWebsocketClient(IntegrationTestCase): | ||
"""Memory usage of websocket client""" | ||
|
||
@test_async_and_sync(globals(), websockets_only=True) | ||
async def test_msg_queue_growth_websocket_client(self, client): | ||
"""Test the rate of growth of the Message queue in websocket_client under | ||
persistent load. Admittedly, this is not a precise measure, rather its a proxy | ||
to measure the memory footprint of the client | ||
""" | ||
|
||
for _ in range(5): | ||
response = await client.request( | ||
BookOffers( | ||
ledger_index="current", | ||
taker_gets=XRP(), | ||
taker_pays=IssuedCurrency( | ||
currency="USD", issuer="rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq" | ||
), | ||
limit=500, | ||
) | ||
) | ||
|
||
self.assertEqual(response.status, ResponseStatus.SUCCESS) | ||
|
||
response = await client.request( | ||
BookOffers( | ||
ledger_index="current", | ||
taker_gets=IssuedCurrency( | ||
currency="USD", issuer="rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq" | ||
), | ||
taker_pays=XRP(), | ||
limit=500, | ||
) | ||
) | ||
self.assertEqual(response.status, ResponseStatus.SUCCESS) | ||
|
||
self.assertEqual(client._messages.qsize(), 0) | ||
|
||
# the messages queue has not increased in proportion to the requests/responses | ||
# input load | ||
self.assertEqual(client._messages.qsize(), 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is against standalone, not mainnet. The data isn't going to really test anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing with a Standalone mode provides a useful baseline, because the performance will only get worse with Mainnet/Testnet.
I'm measuring the memory usage of the client when multiple successive requests are input to the client. (Since no new transactions are provided, there is no need to advance the ledger)
I can set
use_testnet=True
, I'm not opposed to that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current integration test framework does not easily let us test against the mainnet (unless we write additional utility methods). I'm assuming you're referring to the
use_testnet
parameter intest_async_and_sync
decorator.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The integration test framework can be changed, it's not set in stone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you suggesting that I test the performance against the mainnet? Why would that be different than testing with the testnet or the standalone node?
The performance of the xrpl-py client is in question, does it matter if I use a standalone/testnet/mainnet server for this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't enough traffic on testnet/standalone to test the performance of xrpl-py, it's not going to run into any issues. There may not even be any data in this pair (or any pair) for the few seconds that you're testing on. You could theoretically generate that traffic yourself, but that'd require a much more complex test and I'm not sure it's worth that level of complexity.