Consider moving Multibuffer reads off the render thread for src= playback. |
|||
Issue descriptionAt the Edge Dev summit they mentioned they saw significant performance wins by moving src= loading off the render thread. While desktop is mostly MSE, src= is still the majority on Android; which is generally susceptible to main thread contention. In escalating order of importance, we should: 1. Run some local tests with a heavily contended main thread to see how load times are impacted. The new TBMv2 time to play metric should work well for this. 2. If (1) proves fruitful we should look into tagging reads with a completion time so we can log a UMA with the average delivery time to assess total main thread contention. 3. If (1) and (2) show issues, go ahead and investigate / begin work on moving Multibuffer / DataSource reads off of the main thread.
,
Sep 14 2017
Ultimately Multibuffer uses the blink loader under the hood, so +Blink>Loader team in case they have hints/direction for looking into using the loader or something similar off the render thread.
,
Sep 14 2017
This is complementary to similar MSE investigations to potentially move async appendBuffer-parsing (and perhaps also async remove()) off the render main thread that I'll be investigating soon. Thanks for cc'ing me, Dale.
,
Sep 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/cbd817fb8b417bbe16994b62f31e895cbee7e848 commit cbd817fb8b417bbe16994b62f31e895cbee7e848 Author: Fredrik Hubinette <hubbe@google.com> Date: Wed Sep 20 21:25:42 2017 Benchmark page testing video load time when javascript thread is busy. Bug: 765313 Change-Id: I5aaad4b2cffdfccffc52d220ba6cedd29e7642d2 Reviewed-on: https://chromium-review.googlesource.com/673135 Reviewed-by: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Ned Nguyen <nednguyen@google.com> Commit-Queue: Fredrik Hubinette <hubbe@chromium.org> Cr-Commit-Position: refs/heads/master@{#503252} [modify] https://crrev.com/cbd817fb8b417bbe16994b62f31e895cbee7e848/tools/perf/page_sets/tough_video_cases.py [modify] https://crrev.com/cbd817fb8b417bbe16994b62f31e895cbee7e848/tools/perf/page_sets/tough_video_cases/video.html
,
Sep 22 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ff3b31782d552b03104a6d831c7530605b52b13f commit ff3b31782d552b03104a6d831c7530605b52b13f Author: Fredrik Hubinette <hubbe@google.com> Date: Fri Sep 22 21:11:16 2017 avoid thread-jump in multibuffer_datasource::read() This establishes a short-cut when the data is already available in the multibuffer, avoiding a potentially slow jump to the renderer thread and back. Doing this improves the new time-to-play-when-loaded benchmark from 298ms to 124ms on my machine. When not loaded, this benchmarks takes ~80ms. Bug: 765313 Change-Id: Icee120ee0573eb14e75240c6850822583df6a0fa Reviewed-on: https://chromium-review.googlesource.com/677747 Commit-Queue: Fredrik Hubinette <hubbe@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Frank Liberato <liberato@chromium.org> Cr-Commit-Position: refs/heads/master@{#503850} [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer.cc [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer.h [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer_data_source.cc [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer_data_source.h [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer_data_source_unittest.cc [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer_reader.cc [modify] https://crrev.com/ff3b31782d552b03104a6d831c7530605b52b13f/media/blink/multibuffer_reader.h
,
Sep 25 2017
Any opinions on if we should call this fixed or if we should spend more time on it?
,
Sep 25 2017
Seems there's still a ~55% improvement which could be achieved if we pursued this further right? I think we should spend a bit more seeing if there are more low hanging fruit to pick up. If not, do you think it's worth keeping this as available and reconsidering it once blink::WebAssociatedURLLoader can be instantiated on a given thread? How is that working with worker threads today? Do they use a different loading mechanism?
,
Sep 25 2017
Good question, we should probably clue in some loader folks and see what they say.
,
Sep 29 2017
One data point... I was working on https://bugs.chromium.org/p/chromium/issues/detail?id=768553 I modified the benchmark so that it would run 100 times, which takes a while. While it's doing that, the renderer thread is using 100% cpu and is busy for several seconds at a time. This happens while a video is playing. Without the changes in #5, the video would hang for seconds at a time. With the changes in #5, the video would play smoothly. In this benchmark, the entire video was probably in the multibuffer cache though, so loading was probably not an issue.
,
Oct 5 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/439465f8724d4b502355d3683aa8dad2ff076ebf commit 439465f8724d4b502355d3683aa8dad2ff076ebf Author: Fredrik Hubinette <hubbe@google.com> Date: Thu Oct 05 06:47:49 2017 Delay and batch seeks to make them smarter Previously we would call SeekTask for every completed read. This often cause us to seek to somewhere and change our mind a very short time later. By delaying our seeks and batching them together, we can reduce the number of times this happens. I've tested this on a a bunch of badly muxed videos, and generally got improvements. For my primary test video, the number of connections went from ~110 to ~70. As far as I can tell, this has no impact on well-muxed videos. Bug: 765313 Change-Id: I1cfdd803e9cda8fd45fae30ec2c0343f08a79edd Reviewed-on: https://chromium-review.googlesource.com/690978 Commit-Queue: Fredrik Hubinette <hubbe@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Frank Liberato <liberato@chromium.org> Cr-Commit-Position: refs/heads/master@{#506667} [modify] https://crrev.com/439465f8724d4b502355d3683aa8dad2ff076ebf/media/blink/multibuffer_data_source.cc [modify] https://crrev.com/439465f8724d4b502355d3683aa8dad2ff076ebf/media/blink/multibuffer_data_source.h [modify] https://crrev.com/439465f8724d4b502355d3683aa8dad2ff076ebf/media/blink/multibuffer_data_source_unittest.cc
,
Apr 27 2018
I think this is as fixed as it's going to be for the foreseeable future. We may still want to move more things off the renderer thread, but it's not simple and nobody is working on it right now. |
|||
►
Sign in to add a comment |
|||
Comment 1 by dalecur...@chromium.org
, Sep 14 2017