Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel3

...

The purpose of this document is to describe an approach that may be used to analyze FIO read performance of state in the FIO chain plugin and FIO contracts

Objective

The objective is to. Specifically it will:

  • Document all of the uses of get table rows within the chain plugin within fio.

  • Document all of the uses of table find within the fio.contracts.

...

  • Analyze each from a “read performance” perspective and publish a list of the reads along with a level of concern for each.

  • Decide on next steps.

Summary of Results

...

and Next Steps

  • Uses of get table rows is documented below.

  • Alternative options are documented below.

The “Deploy high-powered / modified API plugin” solution was determined to be the easiest solution to deploy and it maintains decentralization. The analysis is tracked here. Development and rollout will be tracked in FIP-46 and this epic.

Alternative Options

Option

Status

Description

Pros

Cons

Centralized

Dev Effort

Low: weeks
Med: 1-2 months
High: 2+ months

QA Effort

Low: 1 week
Med: 2-4 weeks
High: 1m+

Data Migration Effort

Table redesign and migration

Not viable

Redesign tables with proper scope and/or indexes and migrate data to new tables

  • Clean - Table lookups act on primary table

  • Data migration of full tables is complex and prone to error.

  • Migration requires multiple msigs

  • Requires table redesign and new tables

No

High

Med - High

High

New lookup tables

Possible medium to long term solution

Create secondary lookup tables alongside existing tables

  • New tables can be deployed and populated without impacting user experience

  • FIO can “control” the rollout

  • Adds complexity with “duplicate” tables

  • Still requires some migration, but much less than with the full table redesign

No

Med

Med

Med

Off-chain database

Large transaction solution

An off-chain database can be created and the data indexed for specific lookups.

  • Very flexible and easy to add new lookups in the future

  • Fast lookups

  • Data cohesion (keeping offline data in sync with state)

  • Data latency (speed of data syncing)

Yes

Med-High

High

High

Off-chain - block crawling

Crawl each block looking for specific transactions and index those into a local database

  • Understandable architecture and process

  • Can be indexed to local db for fast lookups

  • Centralized

  • Not guaranteed to be in sync with state. Needs validation?

  • Still requires a good data model

Yes

Med (depends on validation)

Low

Low (if you have someone who knows history nodes)

History node

#2?

Can a history node solve any of this?

Initial research shows this may be an offline centralized solution. Needs further research with exchange integrators.

No

Brute force searches (as a service)

#3?

Runtime Javascript code to page through the entire table and pull out needed data. Could be deployed as an API service endpoint on AWS or an integrator can deploy the code in their wallet.

  • Easy to implement and roll out

  • Linear performance degradation as table grows

Yes

Low

Low

Low

Brute force searches (via SDK)

#3?

First try simple version, if more data, do the more complex query.

No

Deploy high-powered / modified API plugin

#1

Remove cpu and other limits on query time for fio API nodeTodo: can we make this a general API plugin?

  • Uses existing node infrastructure

  • Would not need to write new queries

  • Linear performance degradation as table grows

No

Low

Med

Low

Deploy high-powered / modified API node that we host

#1.b

Yes

Limits on number of table entries

Not viable

Put limits in the contracts for table size (as we do for mapped addresses).

  • Easy to code and test

  • Big impact to usability when limiting number of domains or nfts, etc.

Low

Low

Low

...