Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Issue 847883002: Reland "Throttle resource message requests during user interaction" (Closed)

Created:
5 years, 11 months ago by jdduke (slow)
Modified:
5 years, 10 months ago
CC:
chromium-reviews, mkwst+moarreviews-renderer_chromium.org, darin-cc_chromium.org, jam, scheduler-bugs_chromium.org, mlamouri+watch-content_chromium.org, mmenke
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Throttle resource message requests during user interaction Resource message requests can be relatively expensive, particularly in the induced work on the browser IO thread. Currently, there is no bound on the rate with which such requests are dispatched from the renderer. This leads to situations where the browser IO thread is flooded with requests, potentially causing scroll jank and otherwise undesirable stalls in the browser pipeline. Introduce a ResourceMessageThrottler which intercepts and defers a given resource message stream, depending on the state of the RendererScheduler. When the RendererScheduler indicates that high priority work is imminent/likely, requests will be throttled according to a configurable dispatch rate. Hook this throttling mechanism up to the ResourceDispatcher, limiting the number of resource message requests/second during user interaction to 180 (3 per frame at 60 fps) on Android, and 480 on desktop. See goo.gl/H42AgQ for more design details. Note: This change originally landed in https://crrev.com/acfb4199abf841a1577c3968579c43b0232a53b7, but was reverted due to issues with enforced ThreadChecker validation in RendererSchedulerImpl. The ThreadChecker validation fix has been split into a separate patch. BUG=440037, 402136 Committed: https://crrev.com/94ae1f37922badae0012395018c23342f33d13b7 Cr-Commit-Position: refs/heads/master@{#314767}

Patch Set 1 #

Patch Set 2 : Tweak #

Total comments: 19

Patch Set 3 : Partial code review #

Patch Set 4 : Only throttle requests #

Patch Set 5 : Cleanup #

Total comments: 3

Patch Set 6 : Rebase #

Total comments: 6

Patch Set 7 : Code review #

Total comments: 15

Patch Set 8 : Code review #

Patch Set 9 : Stop being clever, only use the following bits 1) is sync IPC, 2) is request IPC #

Total comments: 2

Patch Set 10 : Rebase #

Total comments: 16

Patch Set 11 : Code review #

Total comments: 2

Patch Set 12 : Flush throttled on sync message #

Total comments: 2

Patch Set 13 : Comment fix #

Patch Set 14 : Rebase #

Patch Set 15 : Pull out ThreadChecker fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+703 lines, -1 line) Patch
M content/child/resource_dispatcher.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +6 lines, -0 lines 0 comments Download
M content/content_renderer.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +19 lines, -0 lines 0 comments Download
M content/renderer/scheduler/null_renderer_scheduler.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/scheduler/null_renderer_scheduler.cc View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/scheduler/renderer_scheduler.h View 1 2 3 4 5 6 1 chunk +9 lines, -1 line 0 comments Download
M content/renderer/scheduler/renderer_scheduler_impl.h View 1 2 3 4 5 6 7 10 11 14 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/scheduler/renderer_scheduler_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +11 lines, -0 lines 0 comments Download
M content/renderer/scheduler/renderer_scheduler_impl_unittest.cc View 1 2 3 4 5 6 7 10 11 3 chunks +56 lines, -0 lines 0 comments Download
A content/renderer/scheduler/resource_dispatch_throttler.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +70 lines, -0 lines 0 comments Download
A content/renderer/scheduler/resource_dispatch_throttler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +146 lines, -0 lines 0 comments Download
A content/renderer/scheduler/resource_dispatch_throttler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +370 lines, -0 lines 0 comments Download
M content/test/fake_renderer_scheduler.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/test/fake_renderer_scheduler.cc View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 58 (14 generated)
alex clarke (OOO till 29th)
https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc File content/renderer/scheduler/throttled_message_sender.cc (right): https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode61 content/renderer/scheduler/throttled_message_sender.cc:61: if (!scheduler_->ShouldYieldForHighPriorityWork()) I think you'd get better results if ...
5 years, 11 months ago (2015-01-13 10:38:02 UTC) #2
alex clarke (OOO till 29th)
5 years, 11 months ago (2015-01-13 10:38:04 UTC) #3
picksi1
https://codereview.chromium.org/847883002/diff/20001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/847883002/diff/20001/content/renderer/render_thread_impl.cc#newcode199 content/renderer/render_thread_impl.cc:199: const int kMaxResourceMessageRequestsPerSecondWhenThrottled = 60 * 4; Can you ...
5 years, 11 months ago (2015-01-13 11:24:44 UTC) #5
Sami
Interesting stuff :) https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc File content/renderer/scheduler/throttled_message_sender.cc (right): https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode30 content/renderer/scheduler/throttled_message_sender.cc:30: flush_timer_(FROM_HERE, I wonder if we should ...
5 years, 11 months ago (2015-01-13 14:47:35 UTC) #7
Sami
On 2015/01/13 14:47:35, Sami wrote: > https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode30 > content/renderer/scheduler/throttled_message_sender.cc:30: > flush_timer_(FROM_HERE, > I wonder if ...
5 years, 11 months ago (2015-01-13 14:49:53 UTC) #8
Sami
On 2015/01/13 14:49:53, Sami wrote: > On 2015/01/13 14:47:35, Sami wrote: > > > https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode30 ...
5 years, 11 months ago (2015-01-13 15:04:30 UTC) #9
rmcilroy
https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc File content/renderer/scheduler/throttled_message_sender.cc (right): https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode30 content/renderer/scheduler/throttled_message_sender.cc:30: flush_timer_(FROM_HERE, On 2015/01/13 14:47:35, Sami wrote: > I wonder ...
5 years, 11 months ago (2015-01-13 15:24:38 UTC) #11
alex clarke (OOO till 29th)
https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc File content/renderer/scheduler/throttled_message_sender.cc (right): https://codereview.chromium.org/847883002/diff/20001/content/renderer/scheduler/throttled_message_sender.cc#newcode61 content/renderer/scheduler/throttled_message_sender.cc:61: if (!scheduler_->ShouldYieldForHighPriorityWork()) On 2015/01/13 15:24:37, rmcilroy wrote: > On ...
5 years, 11 months ago (2015-01-13 15:46:55 UTC) #12
alex clarke (OOO till 29th)
Now I've had a chance to think about this patch, here are my thoughts. I ...
5 years, 11 months ago (2015-01-13 16:08:31 UTC) #13
jdduke (slow)
Thanks all for the feedback, I suppose I should have put a WIP or NOT ...
5 years, 11 months ago (2015-01-13 16:18:11 UTC) #14
jdduke (slow)
On 2015/01/13 16:08:31, alexclarke1 wrote: > Now I've had a chance to think about this ...
5 years, 11 months ago (2015-01-13 16:25:42 UTC) #15
jdduke (slow)
mmenke@: Could you take a look at content/renderer/resource_dispatch_throttler.* (either high or low level)? This is ...
5 years, 11 months ago (2015-01-15 04:51:54 UTC) #19
mmenke
On 2015/01/15 04:51:54, jdduke wrote: > mmenke@: Could you take a look at content/renderer/resource_dispatch_throttler.* > ...
5 years, 11 months ago (2015-01-15 15:41:56 UTC) #20
jdduke (slow)
On 2015/01/13 16:08:31, alexclarke1 wrote: > Now I've had a chance to think about this ...
5 years, 11 months ago (2015-01-15 16:45:27 UTC) #21
jdduke (slow)
On 2015/01/15 15:41:56, mmenke wrote: > On 2015/01/15 04:51:54, jdduke wrote: > > mmenke@: Could ...
5 years, 11 months ago (2015-01-22 17:18:36 UTC) #22
mmenke
On 2015/01/22 17:18:36, jdduke wrote: > On 2015/01/15 15:41:56, mmenke wrote: > > On 2015/01/15 ...
5 years, 11 months ago (2015-01-22 17:22:07 UTC) #23
jdduke (slow)
On 2015/01/22 17:22:07, mmenke wrote: > On 2015/01/22 17:18:36, jdduke wrote: > > mmenke@: Should ...
5 years, 11 months ago (2015-01-22 17:26:16 UTC) #24
mmenke
davidben: Have time to review this? I accidentally dropped it on the floor due to ...
5 years, 11 months ago (2015-01-22 17:37:40 UTC) #26
jdduke (slow)
On 2015/01/22 17:37:40, mmenke wrote: > davidben: Have time to review this? I accidentally dropped ...
5 years, 11 months ago (2015-01-26 16:26:38 UTC) #27
alex clarke (OOO till 29th)
lgtm Changes for content/renderer/scheduler/ look good to me, but I'm not currently an owner :) ...
5 years, 11 months ago (2015-01-26 17:16:00 UTC) #28
jdduke (slow)
https://codereview.chromium.org/847883002/diff/140001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/847883002/diff/140001/content/renderer/render_thread_impl.cc#newcode492 content/renderer/render_thread_impl.cc:492: resource_dispatch_throttler_.reset(new ResourceDispatchThrottler( On 2015/01/26 17:15:59, alexclarke1 wrote: > I ...
5 years, 11 months ago (2015-01-26 20:14:49 UTC) #29
Sami
content/renderer/scheduler parts lgtm. https://codereview.chromium.org/847883002/diff/160001/content/renderer/resource_dispatch_throttler.cc File content/renderer/resource_dispatch_throttler.cc (right): https://codereview.chromium.org/847883002/diff/160001/content/renderer/resource_dispatch_throttler.cc#newcode101 content/renderer/resource_dispatch_throttler.cc:101: flush_timer_.SetTaskRunner(scheduler->DefaultTaskRunner()); Should we make this use ...
5 years, 11 months ago (2015-01-27 14:06:06 UTC) #30
jdduke (slow)
Thanks for review! mmenke@: Can you comment on the wrapping issue below? https://codereview.chromium.org/847883002/diff/160001/content/renderer/resource_dispatch_throttler.cc File content/renderer/resource_dispatch_throttler.cc ...
5 years, 11 months ago (2015-01-27 16:59:09 UTC) #31
Sami
Thanks Jared, lgtm % the bit about int64. Let's give the resource folks a chance ...
5 years, 11 months ago (2015-01-27 17:50:12 UTC) #32
davidben
Sorry about the delay. A high-level question before I get too deep into the weeds: ...
5 years, 11 months ago (2015-01-27 22:50:46 UTC) #33
jdduke (slow)
On 2015/01/27 22:50:46, David Benjamin wrote: > Sorry about the delay. A high-level question before ...
5 years, 11 months ago (2015-01-28 00:11:25 UTC) #34
jdduke (slow)
On 2015/01/28 00:11:25, jdduke wrote: > On 2015/01/27 22:50:46, David Benjamin wrote: > > Sorry ...
5 years, 10 months ago (2015-01-28 21:19:35 UTC) #35
jdduke (slow)
I went ahead and implemented the minimally managed/invasive approach, wherein we simply queue all received ...
5 years, 10 months ago (2015-01-28 23:13:29 UTC) #36
davidben
Thanks! Yeah, I think deferring the ResourceDispatcher as a unit is much safer. We're still ...
5 years, 10 months ago (2015-02-03 19:46:48 UTC) #38
jdduke (slow)
Thanks for review. https://codereview.chromium.org/847883002/diff/220001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/847883002/diff/220001/content/renderer/render_thread_impl.cc#newcode488 content/renderer/render_thread_impl.cc:488: On 2015/02/03 19:46:47, David Benjamin wrote: ...
5 years, 10 months ago (2015-02-04 01:39:50 UTC) #39
davidben
Thanks! One last comment that I think slipped through from an older patch set. https://codereview.chromium.org/847883002/diff/240001/content/renderer/scheduler/resource_dispatch_throttler.cc ...
5 years, 10 months ago (2015-02-04 17:10:41 UTC) #40
jdduke (slow)
https://codereview.chromium.org/847883002/diff/240001/content/renderer/scheduler/resource_dispatch_throttler.cc File content/renderer/scheduler/resource_dispatch_throttler.cc (right): https://codereview.chromium.org/847883002/diff/240001/content/renderer/scheduler/resource_dispatch_throttler.cc#newcode56 content/renderer/scheduler/resource_dispatch_throttler.cc:56: if (msg->is_sync()) On 2015/02/04 17:10:41, David Benjamin wrote: > ...
5 years, 10 months ago (2015-02-04 22:54:34 UTC) #41
davidben
lgtm! https://codereview.chromium.org/847883002/diff/260001/content/renderer/scheduler/resource_dispatch_throttler_unittest.cc File content/renderer/scheduler/resource_dispatch_throttler_unittest.cc (right): https://codereview.chromium.org/847883002/diff/260001/content/renderer/scheduler/resource_dispatch_throttler_unittest.cc#newcode262 content/renderer/scheduler/resource_dispatch_throttler_unittest.cc:262: // Unthrottled message types should flush any previously ...
5 years, 10 months ago (2015-02-04 22:57:52 UTC) #42
jdduke (slow)
Thanks for review! https://codereview.chromium.org/847883002/diff/260001/content/renderer/scheduler/resource_dispatch_throttler_unittest.cc File content/renderer/scheduler/resource_dispatch_throttler_unittest.cc (right): https://codereview.chromium.org/847883002/diff/260001/content/renderer/scheduler/resource_dispatch_throttler_unittest.cc#newcode262 content/renderer/scheduler/resource_dispatch_throttler_unittest.cc:262: // Unthrottled message types should flush ...
5 years, 10 months ago (2015-02-05 00:39:48 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/847883002/280001
5 years, 10 months ago (2015-02-05 00:41:07 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/30813)
5 years, 10 months ago (2015-02-05 01:32:43 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/847883002/300001
5 years, 10 months ago (2015-02-05 01:40:11 UTC) #50
commit-bot: I haz the power
Committed patchset #14 (id:300001)
5 years, 10 months ago (2015-02-05 03:47:43 UTC) #51
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/acfb4199abf841a1577c3968579c43b0232a53b7 Cr-Commit-Position: refs/heads/master@{#314739}
5 years, 10 months ago (2015-02-05 03:48:54 UTC) #52
dcheng
A revert of this CL (patchset #14 id:300001) has been created in https://codereview.chromium.org/897223002/ by dcheng@chromium.org. ...
5 years, 10 months ago (2015-02-05 04:39:16 UTC) #53
jdduke (slow)
On 2015/02/05 04:39:16, dcheng wrote: > A revert of this CL (patchset #14 id:300001) has ...
5 years, 10 months ago (2015-02-05 04:52:21 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/847883002/320001
5 years, 10 months ago (2015-02-05 05:29:03 UTC) #56
commit-bot: I haz the power
Committed patchset #15 (id:320001)
5 years, 10 months ago (2015-02-05 06:27:44 UTC) #57
commit-bot: I haz the power
5 years, 10 months ago (2015-02-05 06:28:55 UTC) #58
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/94ae1f37922badae0012395018c23342f33d13b7
Cr-Commit-Position: refs/heads/master@{#314767}

Powered by Google App Engine
This is Rietveld 408576698