New issue
Advanced search Search tips

Issue 883052 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 24
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 853518



Sign in to add a comment

ServiceWorkerSubresourceLoader could read the body blob and side data in parallel

Project Member Reported by wanderview@chromium.org, Sep 11

Issue description

On some site performance profiles I'm seeing subresource loads getting delayed longer when service worker is enabled.  In  bug 882425  I tried hacking out the side data loading code in ServiceWorkerSubresourceLoader and it improved the profile.  This makes sense since starting the blob read as soon as possible allows it to buffer more data sooner.  In this case the subresources did not have any side data, so the IPC round trip and disk hit for the side data read was pure latency overhead.

Lets see if reading the side data and blob body in parallel works.  My initial testing suggests it shows the same benefits as removing the side data.
 
WIP CL that seems to provide similar benefits to removing side data loading from the path:

https://chromium-review.googlesource.com/c/chromium/src/+/1220563

Before submitting for review I want to add a feature to the code so we can do a hold-back trial to measure the impact.
I added a histogram in the CL that measure the time between ServiceWorkerSubresourceLoader::StartResponse() is called and when the Blob::ReadAll() method is called.  In the current codebase I got a P95 delay of ~20ms on my relatively fast machine.  I expect this could have a longer tail on lower end hardware.
On my VM this shows ~5% improvement with some statistical significance (0.06 alpha) on the "cached-fetch" case here:

https://jakearchibald.github.io/service-worker-benchmark/
Note, this bug only helps in the new SW s13n mode.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933

commit e20dc40bd847ca37a3663a0d17c4d4c5d21fc933
Author: Ben Kelly <wanderview@chromium.org>
Date: Tue Sep 18 01:55:42 2018

Load blob body and side data in parallel in ServiceWorkerSubresourceLoader.

Currently the ServiceWorkerSubresourceLoader sequentially reads the blob
side data and then starts reading the main blob data.  This delays when
the disk I/O can start to filling the DataPipe buffer which in turn
increases time to first byte for the resource seen by the page.  Performing
the reads in parallel allows the DataPipe to begin buffering data
immediately.

This CL changes the default behavior to load the main blob data and the
side data in parallel.  The ServiceWorkerParallelSideDataReading feature
is also added to support a future holdback study.  In addition, two new
histograms measure the delays within the loader for starting to read the
main blob data and for notifying the loader client that the body has
started loading.

R=kinuko@chromium.org, rkaplow@chromium.org

Bug:  883052 
Change-Id: If34dbf05074bea8f3067934269099a88f2782bc0
Reviewed-on: https://chromium-review.googlesource.com/1220563
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591914}
[modify] https://crrev.com/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933/content/renderer/service_worker/service_worker_subresource_loader.cc
[modify] https://crrev.com/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933/content/renderer/service_worker/service_worker_subresource_loader.h
[modify] https://crrev.com/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933/third_party/blink/common/features.cc
[modify] https://crrev.com/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933/third_party/blink/public/common/features.h
[modify] https://crrev.com/e20dc40bd847ca37a3663a0d17c4d4c5d21fc933/tools/metrics/histograms/histograms.xml

Project Member

Comment 6 by bugdroid1@chromium.org, Sep 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d31d41fc3662c8ec7d5e334f475222b6e32f678f

commit d31d41fc3662c8ec7d5e334f475222b6e32f678f
Author: Ben Kelly <wanderview@chromium.org>
Date: Tue Sep 18 22:16:41 2018

Fix blob size usage in ServiceWorkerSubresourceLoader.

This line was accidentally deleted in https://crrev.com/c/1220563.

R=mek@chromium.org

Bug:  883052 
Change-Id: I55438446ea228c9828b92845f7df6004244f2240
Reviewed-on: https://chromium-review.googlesource.com/1232274
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592223}
[modify] https://crrev.com/d31d41fc3662c8ec7d5e334f475222b6e32f678f/content/renderer/service_worker/service_worker_subresource_loader.cc

Status: Fixed (was: Started)
Marking this fixed.  If we do a finch trial I will open a new launch bug.

Sign in to add a comment