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

Issue 18932005: Reduce the complexity of WebSocketThrottle's wakeup code (Closed)

Created:
7 years, 5 months ago by tyoshino (SeeGerritForStatus)
Modified:
7 years, 5 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, cbentzel+watch_chromium.org, jam, mmenke
Visibility:
Public.

Description

Reduce the complexity of WebSocketThrottle's wakeup code Currently, job removing code and wakeup code are separate. With the wait queue algorithm employed by WakeupSocketIfNecessary, we have O(N^2 log N) total complexity for shutting down all pending jobs. So, it can make IO thread busy for long time. To prevent such situation occurring for bogus web app, - integrate wakeup code into job removing code so that we can build a list of wakeup candidates from removing process and check only jobs in it. Total complexity for shutdown will then be O(N log N) - have some reasonable limit for the maximum number of WebSocketJob instances pending in the WebSocketThrottle. The number of WebSocketJob instances pending in WebSocketThrottle will be limited up to 1k. Also, the number of active SocketStream instances should be limited. When huge number of WebSocket instances are created, it pressures the browser process. It'll be limited up to 16k. BUG=259005 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=212235

Patch Set 1 #

Patch Set 2 : Correct error codes #

Patch Set 3 : szym and yhirano's comments #

Patch Set 4 : Comment fix #

Total comments: 12

Patch Set 5 : szym and yhirano's comments #

Patch Set 6 : Rebase #

Patch Set 7 : #

Patch Set 8 : android_dbg build fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+135 lines, -44 lines) Patch
M content/browser/renderer_host/socket_stream_dispatcher_host.cc View 3 chunks +19 lines, -0 lines 0 comments Download
M net/base/net_error_list.h View 1 1 chunk +8 lines, -0 lines 0 comments Download
M net/websockets/websocket_job.cc View 1 2 3 4 5 4 chunks +5 lines, -4 lines 0 comments Download
M net/websockets/websocket_job_unittest.cc View 1 2 3 4 5 6 8 chunks +39 lines, -7 lines 0 comments Download
M net/websockets/websocket_throttle.h View 1 2 3 4 2 chunks +15 lines, -9 lines 0 comments Download
M net/websockets/websocket_throttle.cc View 1 2 3 4 5 6 7 6 chunks +49 lines, -24 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
tyoshino (SeeGerritForStatus)
7 years, 5 months ago (2013-07-11 12:31:09 UTC) #1
szym
The correct solution is to fix the O(N lg N) complexity in Wakeup (assuming map ...
7 years, 5 months ago (2013-07-11 17:00:07 UTC) #2
yhirano
Can you write a unittest for too many pending jobs?
7 years, 5 months ago (2013-07-12 02:03:10 UTC) #3
tyoshino (SeeGerritForStatus)
On 2013/07/11 17:00:07, szym wrote: > The correct solution is to fix the O(N lg ...
7 years, 5 months ago (2013-07-12 05:44:38 UTC) #4
tyoshino (SeeGerritForStatus)
On 2013/07/12 02:03:10, yhirano wrote: > Can you write a unittest for too many pending ...
7 years, 5 months ago (2013-07-12 05:44:45 UTC) #5
yhirano
I have an elementary question. Can dead-lock occur in this algorithm? If jobA precedes jobB ...
7 years, 5 months ago (2013-07-12 09:00:15 UTC) #6
tyoshino (SeeGerritForStatus)
On 2013/07/12 09:00:15, yhirano wrote: > I have an elementary question. > Can dead-lock occur ...
7 years, 5 months ago (2013-07-12 10:59:22 UTC) #7
szym
LGTM! Don't forget to update CL description. https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_job_unittest.cc File net/websockets/websocket_job_unittest.cc (right): https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_job_unittest.cc#newcode985 net/websockets/websocket_job_unittest.cc:985: if (i ...
7 years, 5 months ago (2013-07-12 15:31:05 UTC) #8
jochen (gone - plz use gerrit)
lgtm
7 years, 5 months ago (2013-07-12 19:45:27 UTC) #9
yhirano
https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_throttle.cc File net/websockets/websocket_throttle.cc (right): https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_throttle.cc#newcode61 net/websockets/websocket_throttle.cc:61: } else { DCHECK(!iter->second->empty()) would be helpful. https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_throttle.h File ...
7 years, 5 months ago (2013-07-16 02:08:56 UTC) #10
tyoshino (SeeGerritForStatus)
https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_job_unittest.cc File net/websockets/websocket_job_unittest.cc (right): https://codereview.chromium.org/18932005/diff/15001/net/websockets/websocket_job_unittest.cc#newcode985 net/websockets/websocket_job_unittest.cc:985: if (i == kMaxWebSocketJobsThrottled) On 2013/07/12 15:31:05, szym wrote: ...
7 years, 5 months ago (2013-07-17 06:58:26 UTC) #11
yhirano
lgtm
7 years, 5 months ago (2013-07-17 07:21:21 UTC) #12
tyoshino (SeeGerritForStatus)
On 2013/07/12 15:31:05, szym wrote: > LGTM! > Don't forget to update CL description. Yes. ...
7 years, 5 months ago (2013-07-17 07:24:25 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tyoshino@chromium.org/18932005/39001
7 years, 5 months ago (2013-07-17 07:26:35 UTC) #14
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 5 months ago (2013-07-17 07:59:21 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tyoshino@chromium.org/18932005/63002
7 years, 5 months ago (2013-07-17 19:36:14 UTC) #16
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 5 months ago (2013-07-17 20:38:03 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tyoshino@chromium.org/18932005/63002
7 years, 5 months ago (2013-07-17 22:08:23 UTC) #18
commit-bot: I haz the power
7 years, 5 months ago (2013-07-18 04:02:05 UTC) #19
Message was sent while issue was closed.
Change committed as 212235

Powered by Google App Engine
This is Rietveld 408576698