Agoric / dapp-inter

User application for Agoric Inter Protocol—Vaults, BLD Boost, Liquidations, etc.
2 stars 10 forks source link

Inventory of queries to load UI #245

Open samsiegart opened 7 months ago

samsiegart commented 7 months ago

Summary

The app requires many vstorage queries to load all the vault info for each user, as well as the user's smart wallet and purse balances. This issue is just for informational purposes to track each one, and potentially identify areas to reduce overall queries.

Queries

For the user's smart wallet info and purse balances, the following 5 queries are done by the wallet component:

To show all the vault managers, the following 5 vstorage queries are required (see service/vaults.ts):

Additionally, for each vault manager, the following 4 queries are required:

For each vault the user has open, the following query is required:

Tally

This means, for a new user with no open vaults, assuming four collateral types currently, theres:

So a total of 30 queries to load the "Create Vault" page. For each vault the user has open, this adds one additional query. Assuming each query is polled every 6 seconds, that's 5qps per user, which increases by 1qps for every 6 vaults the user has.

Discussion

Some of these queries could be done less frequently, such as the governed params, swingset params, vault manager list, vbankAsset, and boardAux. Roughly estimating, that could subtract 1 query per vault manager, and 6 additional queries from the rest of the list. So assuming 4 vault managers, the number of frequently polled queries could be reduced to 20, for a total of ~3.3qps per user.