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

validate_utf8 performance issues #590

Closed
andresriancho opened this issue Dec 4, 2019 · 1 comment
Closed

validate_utf8 performance issues #590

andresriancho opened this issue Dec 4, 2019 · 1 comment

Comments

@andresriancho
Copy link

andresriancho commented Dec 4, 2019

I'm using websocket-client to communicate with Chrome devtools protocol. Some of the messages that come back from Chrome are large (they contain the whole DOM). While I was testing my software I found a lot of issues, which I initially associated with the socket and how it was read, but they were actually generated by validate_utf8.

I'm not using wsaccel.

All my issues were fixed when I started using skip_utf8_validation in the WebSocket class.

Not really sure how you guys can reproduce this, but the basics are:

  • Capture websocket packets using wireshark
  • Send websocket messages to Chrome (or any other server)
  • Receive large message
  • Verify that in wireshark the server sent the message at timestamp X
  • Verify that the socket returned the message to the upper layers at X+0.001
  • Verify that the websocket returned the message to the upper layers at X+3.0001 , where the extra three seconds (could be more in some cases) are associated with validate_utf8

Then run the same test with skip_utf8_validation and you'll find that there is no delay.

@engn33r
Copy link
Collaborator

engn33r commented Feb 16, 2021

@andresriancho thanks for the comment. If I understand correctly, you are saying that by setting the skip_utf8_validation parameter to True, as found on this line (for WebSocket) or on this line (for WebSocketApp), you improved the performance with large WebSocket messages. I think this is captured in the README.md "Performance" section, which mentions that the "validate_utf8" method is slow. I might move this README performance section to the new project documentation, but if you think there is a better way to highlight the impact of this parameter on overall performance, let me know. I will close this issue since the performance impact is mentioned, although it is an open question for how it can be made clearer.

@engn33r engn33r closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants