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

refactor: drop unused contract preloading infrastructure #7042

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

matklad
Copy link
Contributor

@matklad matklad commented Jun 15, 2022

The preload is the idea that we usually execute a bunch of contracts in
a row, and that we can pipeline the execution a bit:

while the fist contract is execution, we can, on a separate thread, be
preparing context to run the second contract.

We have this implemented in a proof-of-concept state for about a year,
but this has been dead code still. There's some kernel to the idea, but
it doesn't feel like the most impactful thing we can be working on, and,
realistically, this is going to be left untoched for a long time still.

Specific problems:

  • preload doesn't allow us to trivially reduce the cost
  • impact from "white-magic" optimizations like 0-copy deser and mmap
    re-use is likely going to be bigger
  • we already run some things concurrently, so it's not like other CPUs
    are free. If all the cores are busy, preloading is pure overhead
  • we don't trivially know the set of contracts we are going to execute
    in a single call to apply. It's possible to make efficient use of
    preloading, but that requires complicated code outside of
    near-vm-runner and, potentially, even runtime.

@matklad matklad requested a review from nagisa June 15, 2022 11:24
@matklad matklad requested a review from a team as a code owner June 15, 2022 11:24
Copy link
Collaborator

@nagisa nagisa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yas!

@matklad
Copy link
Contributor Author

matklad commented Jun 15, 2022

cc @akhi3030

The preload is the idea that we usually execute a bunch of contracts in
a row, and that we can pipeline the execution a bit:

while the fist contract is execution, we can, on a separate thread, be
preparing context to run the second contract.

We have this implemented in a proof-of-concept state for about a year,
but this has been dead code still. There's some kernel to the idea, but
it doesn't feel like the most impactful thing we can be working on, and,
realistically, this is going to be left untoched for a long time still.

Specific problems:

* preload doesn't allow us to trivially reduce the cost
* impact from "white-magic" optimizations like 0-copy deser and mmap
  re-use is likely going to be bigger
* we already run some things concurrently, so it's not like other CPUs
  are free. If all the cores are busy, preloading is pure overhead
* we don't *trivially* know the set of contracts we are going to execute
  in a single call to `apply`. It's possible to make efficient use of
  preloading, but that requires complicated code outside of
  near-vm-runner and, potentially, even runtime.
@near-bulldozer near-bulldozer bot merged commit ed8058b into near:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants