Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider numpy usage and recommendation #77

Closed
astrand opened this issue Apr 19, 2013 · 2 comments
Closed

Reconsider numpy usage and recommendation #77

astrand opened this issue Apr 19, 2013 · 2 comments
Labels

Comments

@astrand
Copy link

astrand commented Apr 19, 2013

Currently, websockify/websocket.py will give a warning if "numpy" is not available:

WARNING: no 'numpy' module, HyBi protocol is slower or disabled

This is somewhat confusing. First of all, HyBi is definitely not "disabled". And is it really slower? I've done some tests with noVNC, and even when playing Youtube videos with a high frame rate, the process using websocket.py doesn't consume much CPU at all; it rarely shows up in the "top" listing at all. So I'm wondering, has any real measurements been done on this? I've done some Googling and failed to find anything (except problems with numpy...). IMHO, unless we can measure that numpy makes a substantial difference, I think it would be better and more clean to only require standard Python functionality.

@kanaka
Copy link
Member

kanaka commented Apr 19, 2013

The "slower or disabled" part is because there are 4 different python modules that are optional and checked using the same code at the top of websocket.py. For example, if the ssl module is not found, then TLS/wss is disabled. I just pushed a change that will make this clearer.

Numpy is definitely faster. Using the tests/latency.py + tests/latency.html test I get the following results (with 10ms send delay and just running on localhost):

Packet size 2000 bytes:

  • 0.8ms avg roundtrip latency with numpy
  • 1.6ms avg roundtrip latency without numpy

Packet size 20000 bytes:

  • 2.5ms avg roundtrip latency with numpy
  • 9.2ms avg roundtrip latency without numpy

Packet size 100000 bytes:

  • 6.3ms avg roundtrip latency with numpy
  • 40.1ms avg rountrip latency without numpy

In addition, with 100kb packet sizes, no only is the latency more 6 times higher without numpy, but the server starts to get behind and the client has to back off repeatedly during the test.

Note that numpy really only affects client->server data unmasking, so for uses like noVNC it will be basically irrelevant. However, websockify is not just for noVNC, so in the case where the client is sending a lot of data to server, numpy provides significant performance improvement.

@kanaka kanaka closed this as completed Apr 19, 2013
@astrand
Copy link
Author

astrand commented Apr 22, 2013

Thanks!

openstack-gerrit pushed a commit to openstack/puppet-nova that referenced this issue May 27, 2016
In the context of noVNC, numpy adds little performance according
to websockify maintainer: novnc/websockify#77

Change-Id: If35f10db90605ce3faa3555ac5689b631c9b51bf
pkasprzak pushed a commit to gwdg/puppet-nova that referenced this issue May 28, 2016
In the context of noVNC, numpy adds little performance according
to websockify maintainer: novnc/websockify#77

Change-Id: If35f10db90605ce3faa3555ac5689b631c9b51bf
msrba pushed a commit to gwdg/puppet-nova that referenced this issue Jul 26, 2016
In the context of noVNC, numpy adds little performance according
to websockify maintainer: novnc/websockify#77

Change-Id: If35f10db90605ce3faa3555ac5689b631c9b51bf
dlundquist added a commit to dlundquist/ursula that referenced this issue Aug 18, 2016
From openstack/puppet-nova:

    In the context of noVNC, numpy adds little performance according
    to websockify maintainer: novnc/websockify#77

By removing python-numpy we remove the Fortran dependency.
omgjlk pushed a commit to blueboxgroup/ursula that referenced this issue Sep 14, 2016
From openstack/puppet-nova:

    In the context of noVNC, numpy adds little performance according
    to websockify maintainer: novnc/websockify#77

By removing python-numpy we remove the Fortran dependency.
hectorm added a commit to hectorm/docker-qemu-reactos that referenced this issue Jun 10, 2020
hectorm added a commit to hectorm/docker-qemu-haiku that referenced this issue Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants