Websockets #1528
Conversation
|
k6 load testing comparison.
Legend: Avg - Average Response Time, Max - Maximum Response Time, 90 - 90th Percentile, 95 - 95th Percentile |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Signed-off-by: GuticaStefan <stefan.gutica@gmail.com>
| collectionPropertiesFromGateway: false | ||
| features: | ||
| websocketSubscription: | ||
| enabled: true |
There was a problem hiding this comment.
make them disabled by default maybe? can be left as a TODO before PR's merging
# Conflicts: # config/config.mainnet.yaml
| @ConnectedSocket() client: Socket, | ||
| @MessageBody(new WsValidationPipe()) payload: BlockSubscribePayload | ||
| ) { | ||
| const filterHash = JSON.stringify(payload); |
There was a problem hiding this comment.
this is not really a hash, so maybe we should update the naming to something like filterIdentifier. Please apply this suggestion in all the gateways
| handleDisconnect(_client: Socket) { } | ||
|
|
||
| handleConnection(client: Socket, ..._args: any[]) { | ||
| client.setMaxListeners(12); |
There was a problem hiding this comment.
is it enough? should we extract this number to the config file?
There was a problem hiding this comment.
if the number is exceeded we will only receive a warning(not error) from EventEmitter, but it doesn't affect the functionality. For the moment, until we add another class like blocks,pools,... for ws subscription, that warning should not appear
| @@ -0,0 +1,29 @@ | |||
| // block-subscribe.dto.ts | |||
There was a problem hiding this comment.
remove this comment
| @@ -0,0 +1,20 @@ | |||
| // block-subscribe.dto.ts | |||
There was a problem hiding this comment.
remove this comment
| @@ -0,0 +1,16 @@ | |||
| // ws-validation.pipe.ts | |||
There was a problem hiding this comment.
remove this comment
* Enhance error handling in GatewayProxyController for block retrieval by hash (#1545) * use EsdtType instead of hardcoded values (#1544) * token service improvements (#1543) * processes 50 tokens concurrently using ConcurrencyUtils * run all three batch operations in parallel with increased concurrency * add more logs * apply mex prices * add logs ( to be removed ) * increse cron time expression * set cron to 2 minutes * Websocket subscriptions (#1528) * add websockets for blocks and txs * add support for subscribe to stats * use websockets rooms * remove logs * add lock on crons * check stats room exists Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> * fix indent spaces * add validation pipes + filters * add try catch + class validator fixes * fix linter * add pool subscription + reduce filters combinations for subscriptions * lint * add support for events subscription * lint * separate subscription websocket into separate app * add config * add path * fix * add path for events + config default settings * temp logs * temp logs 2 * added missing configs + remove temp logs * enable andromeda in config * add metrics on subscription * remove async + reschedule * refresh metrics every second * set max listeners to 12 * add EOL * add count on update + parallel broadcast to rooms * lower ttl for blocks count cache * remove comments * remove comments * renaming --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: bogdan-rosianu <bogdan.rosianu@yahoo.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com> * log instead of error for invalid legacy delegation contract (#1542) --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: Catalin Faur <52102171+cfaur09@users.noreply.github.com> Co-authored-by: Gutica Stefan <123564494+stefangutica@users.noreply.github.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com>
* Enhance error handling in GatewayProxyController for block retrieval by hash (#1545) * use EsdtType instead of hardcoded values (#1544) * token service improvements (#1543) * processes 50 tokens concurrently using ConcurrencyUtils * run all three batch operations in parallel with increased concurrency * add more logs * apply mex prices * add logs ( to be removed ) * increse cron time expression * set cron to 2 minutes * Websocket subscriptions (#1528) * add websockets for blocks and txs * add support for subscribe to stats * use websockets rooms * remove logs * add lock on crons * check stats room exists Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> * fix indent spaces * add validation pipes + filters * add try catch + class validator fixes * fix linter * add pool subscription + reduce filters combinations for subscriptions * lint * add support for events subscription * lint * separate subscription websocket into separate app * add config * add path * fix * add path for events + config default settings * temp logs * temp logs 2 * added missing configs + remove temp logs * enable andromeda in config * add metrics on subscription * remove async + reschedule * refresh metrics every second * set max listeners to 12 * add EOL * add count on update + parallel broadcast to rooms * lower ttl for blocks count cache * remove comments * remove comments * renaming --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: bogdan-rosianu <bogdan.rosianu@yahoo.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com> * log instead of error for invalid legacy delegation contract (#1542) * implement event logAddress filter (#1548) * implement event logAddress filter * implement topics filter * Token market cap updates (#1550) * token mcap update * add logs * extend logs * add support for timestampMs for account * fix unit tests * improve token fetch price (#1549) * improve token fetch price * remove logger * update spec * fix lint error * add logs for error * add price * Enhance NFT type support in cache warmer and collection services (#1552) * Refactor function filter application in ElasticIndexerHelper to enhance query conditions with AND operator and existence checks (#1554) * apply supply info for all tokens (#1558) * Refactor token market cap calculation to ensure price and circulating supply are checked before computation * add specs * fix lint * added reserved field to blocks (#1560) * add support for custom url custom headers (#1557) * Add custom URL headers support and enhance token data fetching * Enhance custom URL headers handling by adding JSON parsing and validation checks * add logs * fixes * remove app.hatom.com value * add EOL * fix indentation --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: Catalin Faur <52102171+cfaur09@users.noreply.github.com> Co-authored-by: Gutica Stefan <123564494+stefangutica@users.noreply.github.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com> Co-authored-by: GuticaStefan <stefan.gutica@gmail.com>
* extend features flags config values * fixes after review + test fix * set more default configs to false * fixes after merge * Enhance error handling in GatewayProxyController for block retrieval by hash (#1545) * use EsdtType instead of hardcoded values (#1544) * token service improvements (#1543) * processes 50 tokens concurrently using ConcurrencyUtils * run all three batch operations in parallel with increased concurrency * add more logs * apply mex prices * add logs ( to be removed ) * increse cron time expression * set cron to 2 minutes * Websocket subscriptions (#1528) * add websockets for blocks and txs * add support for subscribe to stats * use websockets rooms * remove logs * add lock on crons * check stats room exists Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> * fix indent spaces * add validation pipes + filters * add try catch + class validator fixes * fix linter * add pool subscription + reduce filters combinations for subscriptions * lint * add support for events subscription * lint * separate subscription websocket into separate app * add config * add path * fix * add path for events + config default settings * temp logs * temp logs 2 * added missing configs + remove temp logs * enable andromeda in config * add metrics on subscription * remove async + reschedule * refresh metrics every second * set max listeners to 12 * add EOL * add count on update + parallel broadcast to rooms * lower ttl for blocks count cache * remove comments * remove comments * renaming --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: bogdan-rosianu <bogdan.rosianu@yahoo.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com> * log instead of error for invalid legacy delegation contract (#1542) * implement event logAddress filter (#1548) * implement event logAddress filter * implement topics filter * Token market cap updates (#1550) * token mcap update * add logs * extend logs * add support for timestampMs for account * fix unit tests * improve token fetch price (#1549) * improve token fetch price * remove logger * update spec * fix lint error * add logs for error * add price * Enhance NFT type support in cache warmer and collection services (#1552) * Refactor function filter application in ElasticIndexerHelper to enhance query conditions with AND operator and existence checks (#1554) * apply supply info for all tokens (#1558) * Refactor token market cap calculation to ensure price and circulating supply are checked before computation * add specs * fix lint * added reserved field to blocks (#1560) * add support for custom url custom headers (#1557) * Add custom URL headers support and enhance token data fetching * Enhance custom URL headers handling by adding JSON parsing and validation checks * add logs * fixes * remove app.hatom.com value * add EOL * fix indentation * API-741: staking v5 support * bugfix * fix lint * refactor * fixes * try-catch for queue computing * hotfix disable snapshotless * revert * add staking v5 activation epoch feature * added devnet config * small fix * added mainnet config * add stakingv5 e2e configs * Deprecate relayed v1/v2 (#1564) * Add transaction reordering by nonce for account sent transactions * add relayed deprecation to transfers as well * add custom subscriptions * fix lint * fix lint & unit tests * hardcode class fields * lint * refactor * add tests for room key generator * iterate over round only if there are active subscriptions * improvements * add support for unsubscribe * lint * add support for events * add support for timestampMs in ES * lint * hardcode timestamp supernova in the future * extra checks + clean code * fixes * fixes * typo * use latest chainsim * fix * add unit tests for transaction reordering by nonce for account sent transactions (#1572) * add chain simulator e2e tests * lint * fix * missing comma * fix * Refactor account, NFT, and transaction services to improve concurrency and caching * improve NFT bulk fetch + applyOwner * add no empty payload validator for custom subscriptions * add global subscription limiter * remove log * add e2e tests for events * lint * added metric per topics * updates * implement ConcurrencyUtils in collection service * add tests for general subscriptions * add newline * use timestampMs * revert e2e mainnet config * custom verbose * use timestampMs on chain sim network * add subscription limits to config * fix * update configs * use barnard config * typo * added readme * typo * add lock on subscriptions * use same key for lock * fix * add async mutex * lint * return success status on stats * return unsubscribed status on stats * config update * collection service improvments * fix spec * fixes * fixes * add support for transfers subscription * add support for token transfers subscriptions * add ws transfers e2e tests * fix unit tests * fix transction filters cache * remove duplicate code * add new line * encapsulate into variable * renaming * refactoring + skip unneeded iterations for duplicate keys * explanation comments * add unit test for disallowed field comb constraint * fixes after review * add configurable broadcast interval * add check keys present for transfers + events filtered * remove async await * fix * fix nft attributes source * fix lint * allow admins to trigger nft updates * print * revert log --------- Signed-off-by: GuticaStefan <stefan.gutica@gmail.com> Co-authored-by: Catalin Faur <52102171+cfaur09@users.noreply.github.com> Co-authored-by: Gutica Stefan <123564494+stefangutica@users.noreply.github.com> Co-authored-by: cfaur09 <catalinfaurpaul@gmail.com> Co-authored-by: GuticaStefan <stefan.gutica@gmail.com>
Reasoning
Proposed Changes
transactions,blocksandstatsHow to test
Example:
client1: subscribeTransactions with payload {from=0, size=10}, subscribeBlocks with payload {from=0, size=2}
client2: subscribeTransactions with payload {from=0, size=2}, subscribeBlocks with payload {from=0, size=5}, subscribeStats
on each client you should only receive data the same as you would request that specific endpoint with those specific parameters and the server
mustperform only 1 computation per eachroomat a specific interval regardless of the number of clients in that room -> a room is unique by topic and payload (filter parameters)