openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
276 stars 202 forks source link

Issue with mediator when many users are trying to connect with mediator using `PickUpV2` as a mediator pickup strategy. #2078

Open sairanjit opened 3 weeks ago

sairanjit commented 3 weeks ago

We are facing issue with mediator even when 200+ users are trying to connect with mediator using pickupv2 as a mediator pickup strategy. We are observing Database CPU usage crosses 99% with instance type : RDS m6i.xlarge & RDS m6i.2xlarge both are tried

We also tried using the AWS RDS Proxy as suggested here https://github.com/hyperledger/aries-askar/blob/main/docs/storage.md#aws-rds-proxy but are still facing the same problem.

We are using the following mediator https://github.com/credebl/mediator-agent

We are getting high CPU utilisation due to the below query

SELECT id, kind, category, name, value, (SELECT ARRAY_TO_STRING(ARRAY_AGG(it.plaintext  ?  ENCODE(it.name, ?)  ?  ENCODE(it.value, ?)), ?) FROM items_tags it WHERE it.item_id = i.id) tags FROM items i WHERE profile_id = $1 AND (kind = $2 OR $2 IS NULL) AND (category = $3 OR $3 IS NULL) AND (expiry IS NULL OR expiry > CURRENT_TIMESTAMP) AND ((i.id IN (SELECT item_id FROM items_tags WHERE name = $4 AND value = $5 AND SUBSTR(value, ?, ?) = $6 AND plaintex

Please suggest if any changes required or any recommendations for configurations