New issue
Advanced search Search tips

Issue 591974 link

Starred by 5 users

Issue metadata

Status: WontFix
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Websocket performance degradation since 48.0.2564.97

Reported by s...@samknows.com, Mar 4 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Example URL:
N/A

Steps to reproduce the problem:
1. Create a simple websocket server that writes blobs repeatedly. For example, in go:

package main

import (
        "net/http"
        "golang.org/x/net/websocket"
)

func speedtestHandler(ws *websocket.Conn) {

   var s []byte
   s = make([]byte, 1000000, 1000000)
   for {
      websocket.Message.Send(ws, s)
   }
}

func main() {
        http.Handle("/echo", websocket.Handler(speedtestHandler))
        err := http.ListenAndServe(":6502", nil)
        if err != nil {
                panic("ListenAndServe: " + err.Error())
        }
}

#########

2. Start the server on a Linux box, connected at 1Gbps to an Ethernet switch.

#########

3. Create a simple HTML page that downloads blobs from this websocket server and prints the throughput (changing the wsUri link accordingly to the Linux server's IP). For example:

<!DOCTYPE html>

<meta charset="utf-8" />

<title>WebSocket Test</title>

<script language="javascript" type="text/javascript">

  var wsUri = "ws://192.168.2.50:6502/echo";
  var output;
  var count = 0;
  var start = 0;
  var realstart = 0;
  var size = 1000000;

  function init()
  {
    output = document.getElementById("output");
    testWebSocket();
  }

  function testWebSocket()
  {
    for(var i=0; i<4; i++) {
       websocket = new WebSocket(wsUri);
       websocket.onopen = function(evt) { onOpen(evt, this) };
       websocket.onclose = function(evt) { onClose(evt, this) };
       websocket.onmessage = function(evt) { onMessage(evt, this) };
       websocket.onerror = function(evt) { onError(evt, this) };
    }
  }

  function onOpen(evt, ws)
  {
    writeToScreen("CONNECTED");
    start = Date.now();
    doSend(""+size, ws);
  }

  function onClose(evt)
  {
    writeToScreen("DISCONNECTED");
  }

  function onMessage(evt, ws)
  {
    //writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data.size + '</span>');
    //websocket.close();
    if (evt.data instanceof Blob) {
       count++;
       if (Date.now() - start < 5000) {
          doSend(""+size, ws);
       } else {
          var duration = Date.now() - start;
          writeToScreen('Transferred ' + (count*size) + ' bytes in '+duration+'ms. Speed: '+(((count*size)/(duration/1000))*0.000008)+' Mbps');
          ws.close();
       }
    }
  }

  function onError(evt)
  {
    writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data);
  }

  function doSend(message, ws)
  {
    ws.send(message);
  }

  function writeToScreen(message)
  {
    var pre = document.createElement("p");
    pre.style.wordWrap = "break-word";
    pre.innerHTML = message;
    output.appendChild(pre);
  }

  window.addEventListener("load", init, false);

</script>

<h2>WebSocket Test</h2>

<div id="output"></div>

#########

4. On a Mac OSX machine, connected with at 1Gbps via ethernet to the same network, navigate to the web page just created.

#########

5. Observe the speed measured

What is the expected behavior?
On a 1Gbps Ethernet network, you should see ~945Mbps download speed recorded (at the application layer).

Latest Chrome, Firefox and IE on a PC all see ~945Mbps. Firefox on Mac OSX also records ~945Mbps. Recent versions of Chrome on Mac OSX do not!

What went wrong?
Chrome on Mac OSX is seeing very degraded performance when fetching binary data via websockets. This problem was introduced sometime between Chromium 47.0.2526.111 and 48.0.2564.97. Versions since 48.0.2564.97 are recording ~600Mbps on a 1Gbps Ethernet network. Versions prior to this are receiving data at ~945Mbps, as is expected.

A breakdown of test results on different versions of Chromium is attached.

Did this work before? Yes 47.0.2526.111

Chrome version: 49.0.2623.75  Channel: n/a
OS Version: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36
Flash Version: Shockwave Flash 20.0 r0

The use case is a websockets based speed test.
 
Chromium Mac 2016 03 04.xlsx
11.1 KB Download

Comment 1 by b...@chromium.org, Mar 4 2016

Components: -Internals>Network Internals>Network>DNS Blink>Network>WebSockets
Labels: Performance
Owner: yhirano@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for detailed report with code and measurement results.

yhirano@, please try to reproduce this.

I skimmed revision log between 47.0.2526.111 and 48.0.2564.97 but couldn't find any suspicious CL.
47.0.2526.111:
Commit: e062e91c22bb128f5377e4510bec01900daf35ff
Branch Base Commit: cb947c0153db0ec02a8abbcb3ca086d88bf6006f
Branch Base Position: 352221
V8 Version: 4.7.80.31
V8 Position: 31014
Skia Commit: ba4e83be6027e68aacc2f1c581e839e88d845c38
Blink Revision: unknown
Blink Branch Position: unknown


48.0.2564.97:
Commit: 76bc56ae79e5f501eaf1ed311ff828f6daf8538a
Branch Base Commit: 1283eca15bd9f772387f75241576cde7bdec7f54
Branch Base Position: 359700
V8 Version: 4.8.271.17
V8 Position: 1
Skia Commit: 47f2cbd7676d37c28d30f9f34476820adb32d1a3
Blink Revision: unknown
Blink Branch Position: unknown
Components: -Internals>Network>DNS
Removing Internals>Network>DNS since it sounds like this happens once the websocket is connected. Feel free to add back if it seems the culprit after further investigation.
Status: WontFix (was: Assigned)
Sorry for not responding.

I remember I did investigate but significant performance regression was not observed. Let me close this old bug...

Sign in to add a comment