With devtools open, websockets are very slow hanging the browser for multiple seconds when doing large(r) blobs on localhost
Reported by
r...@n4.io,
Mar 15 2016
|
||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Example URL: https://gist.github.com/onejsdev/c1aa09aa6a248c9d2dba Steps to reproduce the problem: 1. Download single sourcefile (selfcontained) 2. run with nodeJS 3. Open http://localhost:2000/ What is the expected behavior? I'm expecting local-memory speed or atleast in the order of 100s of megabytes per second transfer rate for a local loopback websocket. What went wrong? Websockets are incredibly slow (<80mbits on local loopback) and large buffers (few megabytes) hang the browser for multiple seconds. Making the buffers smaller but sending more of them in the same timespan doesnt change the browser behavior it still hangs like its doing something heavy which it really shouldnt be. Using XHR as a channel for the same data easily has a 10-20x performance increase. The browser visibly synchonously hiccups/hangs when receiving or sending the data for very long periods of time which it also shouldnt. Did this work before? N/A Chrome version: 49.0.2623.87 Channel: stable OS Version: OS X 10.11.2 Flash Version: Shockwave Flash 21.0 r0
,
Mar 21 2016
,
Apr 15 2016
Sorry for the slow response. I see 70~90 mbyte/s with Chrome, 120~150 mbyte/s with Firefox, 70~80 mbyte/s with Safari. It's slower than you expected but I don't see 10x~20x performance regression in my environment. Could you measure the performance with other browsers?
,
Jul 26 2016
I have managed to reproduce this bug, with both results. Running the script with DevTools open results in ~9 MB/s, while running the script without DevTools open results in >90 MB/s. The problem is likely caused by the processing of the entire WebSocket message on the main browser thread. DevToolsClientMsg_DispatchOnInspectorFrontend seems to be the IPC-message triggering this.
,
Jul 26 2016
,
Jul 27 2016
DevTools are expected to slow down things. Is that a problem? Aren't you inspecting/debugging with DevTools open, and not exactly measuring performance?
,
Jul 27 2016
I would say that DevTools are expected to make it easy to develop web pages (including profiling them). That some things become slow is an unfortunate side effect. In this case the performance hit is rather large so somebody might want to take a look that the performance hit is actually necessary. I'm not sure why DevTools would have to slow down WebSockets this much. It seems like a bug to me, but then I'm not familiar with all the DevTools features.
,
Jul 29 2016
,
Jul 14 2017
,
Jul 18 2017
I cannot run this code because it's a bit too large for me to read and ensure there's no security risks on our side. Is there a chance you could give me a simple script that I can run to repro this case? I can say that this is likely not a bug, but a requirement. If you are sending megabytes of data, we will be holding a copy of all this data in devtools. Here's a high overview of what happens here... * Browser process receives data and IPCs it to the renderer process * Renderer receives this data and sends it to inspector (if inspector exists) * Inspector constructs a JSON message and sends it off to browser to send to devtools ui * Browser receives JSON and does an IPC hop to devtools Main thread for V8 to parse * V8 parses JSON message and executes some javascript for devtools to handle * Devtools takes the raw data and stores it into memory just in case the user needs it There are 3 IPC hops here and each one of these steps stores and transports at data that is at least the size of the received or sent frame. JSON'ifying is slow and V8 parsing the JSON is slow. If these start becoming a bottleneck it will put back-pressure on the entire chain. This will currently happen regardless of if tracing or not. I spoke to our TL and we recognize this as a pain point and we will see about coming up with a plan to speed this up a bit.
,
Jul 19 2017
I have attached the test code I used a year ago to reproduce this. I hope it's at least a little helpful. server.py (python2) requires Flask, gevent.pywsgi and gevent-websocket. Launch the server, open localhost:5000, and then press "Ping" to send a ~50 MB message over the websocket. It displays the current mouse position as a way to show when v8 is busy (mouse position won't update).
,
Dec 13 2017
Closing due to lack of priority / resources.
,
Mar 27 2018
I am also affected by this issue. I understand it has been marked WontFix, but is there a way to disable that behavior (i.e. not record the websocket frames when devtools are open)? ? I want to debug other parts of our application, but the extreme slowdown of the devtools and the page itself makes it very difficult.
,
May 14 2018
I would like to take a look.
,
Sep 18
,
Nov 9
Issue 834436 has been merged into this issue.
,
Nov 9
Issue 859803 has been merged into this issue. |
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by rsleevi@chromium.org
, Mar 15 2016Components: Blink>Network>WebSockets