Skip to content
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

IAVL Gas pricing #2860

Closed
ValarDragon opened this issue Nov 19, 2018 · 0 comments
Closed

IAVL Gas pricing #2860

ValarDragon opened this issue Nov 19, 2018 · 0 comments

Comments

@ValarDragon
Copy link
Contributor

ValarDragon commented Nov 19, 2018

Currently our IAVL gas pricing is a bit naive. Its pricing model currently is a flat "get" fee, plus some cost per byte read. However the work is really constant overhead + O(depth) + db read per byte + rebalance cost at a given depth.

  • We should definitely have a cost per depth, since these are extra reads that are required.

  • For rebalancing, there are a couple options, either amortize the rebalance cost over the minimal number of operations until next rebalance, have a full rebalance charge at once, or make some metric to determine how much closer to a rebalance its being pushed. There are downsides to both:

    • If we amortize to the minimum number of operations until the next rebalance, then in most scenarios the total amount charged for this will be more than the cost of rebalancing. If the tree is perfectly balanced and of size n, I can typically make it rebalance with n/2 deletes, but on average it will take more operations to force it to rebalance. This also complicated, since you have to do this calculation for every depth.
    • Having a full rebalance charge during a rebalance is do-able. It also avoids the above complications and can be an extremely precise charge, but it kinda sucks that one person is getting the charge for the rebalance.
    • Making some metric for determining how close we are being pushed to a rebalance at every given depth is do-able. We just have to do it at every depth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants
@ValarDragon @tac0turtle and others