New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 730587 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 733466
issue 737890



Sign in to add a comment

Create spare renderer from omnibox

Project Member Reported by mattcary@chromium.org, Jun 7 2017

Issue description

In order to reduce search startup time from the omnibox, create a spare renderer when it is likely that a web search will be done. This will pipeline renderer process creation for search queries when there is a service worker.

The idea is to use a factory all the time in RenderProcessHostImpl::GetProcessHostForSiteInstance instead of just for testing as is currently done. This factory will hold a single RenderProcessHost which can be created on demand. When called with a matching browser_context and storage_partition, it will return the host if it exists. If the context and partition don't match it will be destroyed.

We discussed starting a service worker bound to the domain of the default search provider, which would also pipeline the service worker initialization. However, currently this would also mean that a new renderer process will be created for the navigation. If the service worker is started with the navigation (as it would be with the spare renderer idea), then they will live in the same process when appropriate. Thus we avoid using two processes at the expense of not saving service worker initialization time.


 

Comment 1 by creis@chromium.org, Jun 14 2017

Cc: creis@chromium.org
Components: Blink>ServiceWorker UI>Browser>Navigation Internals>Core
Blocking: 733466
I ran a quick test on a Nexus 5 (M) comparing this spare renderer implementation to a build from head. I used a test account that we had opted into the Search PWA experiment and I confirmed that SWs were created as expected.

The test is based off of crrev.com/2929113002 with an additional patch to warm up the spare renderer from AutocompleteController.startZeroSuggest().

For each data point, I closed all tabs and killed all service workers (from chrome://inspect/?tracing), then opened up wikipedia.org, waited for it to settle, started tracing, clicked the omnibox, typed "ba" and selected "babar" from the suggestions, waited for the search page to settle, then stopped tracing. I did this 5 times for each build of Chrome.

I used NavigationControllerImpl::LoadURLWithParams and firstTextPaint as my points of reference (for some reason, firstContentfulPaint wasn't showing up, I'm not sure why).

The results are attached. The spare renderer was 150ms faster (median) than the stock version, out of a ~0.5 second load-to-paint time. Yay! There was an outlier in each data set, but the result was still significant (0.03 p-value from a permutation test).

We will probably see different results in the wild, but I think this gives us an order-of-magnitude of the improvement and is consistent with our expectations.
spare-FTP.csv
389 bytes View Download

Comment 4 by lizeb@chromium.org, Jun 20 2017

Great!

The N5 is probably close to a best-case scenario with respect to
performance, so the actual improvements should be larger on real world
devices.
150ms sounds about right, in the past we got more with a spare webcontents,
but that was for startup, which includes first time initialization, etc.

Comment 5 by horo@chromium.org, Jun 20 2017

Awesome!

Could you please test with PlzNavigate enabled?
You can enable PlzNavigate from chrome://flags/#browser-side-navigation.

Here it is. The difference is smaller, only 70ms, but still significant.
spare-FTP.csv
871 bytes View Download
Blocking: 737890
Project Member

Comment 8 by bugdroid1@chromium.org, Jul 13 2017

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

commit 28c8676d89927c00b9e64dfdb7681027d93a37df
Author: mattcary <mattcary@chromium.org>
Date: Thu Jul 13 14:26:31 2017

Enable spare RenderProcessHost to be preinitialized.

Enables a preinitialization of an unbound RenderProcessHost, and refactors
RenderProcessHost creation to allow that to be used where appropriate.

BUG= 730587 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2929113002
Cr-Commit-Position: refs/heads/master@{#486372}

[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/about_flags.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/android/chrome_feature_list.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/android/chrome_feature_list.h
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/android/warmup_manager.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/flag_descriptions.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/chrome/browser/flag_descriptions.h
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/browser_context.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/frame_host/render_frame_host_manager.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/renderer_host/render_process_host_browsertest.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/renderer_host/render_process_host_impl.h
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/browser/renderer_host/render_process_host_unittest.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/public/browser/render_process_host.h
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/public/test/mock_render_process_host.cc
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/content/public/test/mock_render_process_host.h
[modify] https://crrev.com/28c8676d89927c00b9e64dfdb7681027d93a37df/tools/metrics/histograms/enums.xml

Comment 9 by falken@chromium.org, Jul 14 2017

The CL in comment 8 was reverted in https://crrev.com/44c7177cb8f4e5e708942709b for  issue 742533 .
Project Member

Comment 10 by bugdroid1@chromium.org, Jul 19 2017

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

commit ab08362cb469d48e79bee165b56d7bf962382490
Author: Benoit Lize <lizeb@chromium.org>
Date: Wed Jul 19 14:50:54 2017

Reland "Enable spare RenderProcessHost to be preinitialized.""

Reason: fixed test.
This reverts commit 44c7177cb8f4e5e708942709b4dc7bd81dc85f50.
Original CL by mattcary@chromium.org
Original CL:
> Enable spare RenderProcessHost to be preinitialized.

> Enables a preinitialization of an unbound RenderProcessHost, and refactors
> RenderProcessHost creation to allow that to be used where appropriate.

> BUG= 730587 
> CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

TBR=qyearsley@chromium.org,mattcary@chromium.org,tedchoc@chromium.org

Bug:  730587 , 742533 
Change-Id: I61c37031e2872a5f9817543418cd30f253e70e4b
Reviewed-on: https://chromium-review.googlesource.com/575988
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487859}
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/android/java/src/org/chromium/chrome/browser/omnibox/AutocompleteController.java
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/about_flags.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/android/chrome_feature_list.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/android/chrome_feature_list.h
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/android/warmup_manager.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/flag_descriptions.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/chrome/browser/flag_descriptions.h
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/browser_context.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/frame_host/render_frame_host_manager.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/renderer_host/render_process_host_browsertest.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/renderer_host/render_process_host_impl.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/renderer_host/render_process_host_impl.h
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/browser/renderer_host/render_process_host_unittest.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/public/browser/render_process_host.h
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/public/test/mock_render_process_host.cc
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/content/public/test/mock_render_process_host.h
[modify] https://crrev.com/ab08362cb469d48e79bee165b56d7bf962382490/tools/metrics/histograms/enums.xml

Status: Fixed (was: Started)
I believe that we are done here :)
Labels: M-61 OS-Android

Sign in to add a comment