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

Use FuturesUnordered to track ops, fix latency issues #2131

Merged
merged 3 commits into from Apr 16, 2019

Commits on Apr 16, 2019

  1. Copy the full SHA
    2719631 View commit details
    Browse the repository at this point in the history
  2. core: run isolate tests within a task

    This change is made in preparation for using FuturesUnordered to track
    futures that are spawned by the isolate. FuturesUnordered sets up
    notififications for every future that it finds to be not ready when
    polled, which causes a crash if attempted outside of a task context.
    piscisaureus committed Apr 16, 2019
    Copy the full SHA
    dd59522 View commit details
    Browse the repository at this point in the history
  3. core: make Isolate use FuturesUnordered to track ops

    Additionally, instead of polling ops in a loop until none of them are
    ready, the isolate will now yield to the task system after delivering
    the first batch of completed ops to the javascript side.
    
    Although this makes performance a bit worse (about 15% fewer
    requests/second on the 'deno_core_http_bench' benchmark), we feel that
    the advantages are worth it:
    
    * It resolves the extremely high worst-case latency that we were seeing
      on deno_core_http_bench, in particular when using the multi-threaded
      Tokio runtime, which would sometimes exceed a full second.
    
    * Before this patch, the implementation of Isolate::poll() had to loop
      through all sub-futures and poll each one of them, which doesn't scale
      well as the number of futures managed by the isolate goes up. This
      could lead to poor performance when e.g. a server is servicing
      thousands of connected clients.
    piscisaureus committed Apr 16, 2019
    Copy the full SHA
    7807afa View commit details
    Browse the repository at this point in the history