[Libwebsockets] libwebsocket vs regular-sockets performance
hkumar at arubanetworks.com
Wed Nov 13 20:03:41 CET 2013
I am performing some benchmarking study for traffic flow in between libwebsocket client -server and regular tcp client-server. My tcp client is making writes to blocking sockets.
I am sending 1000 MB of char buffer. In case of regular tcp sockets, it takes Total time of 4 sec 525 ms 317 us 0 ns but in case of websockets, it takes total time of 8 sec 844 ms 365 us 832 ns.
This experiment was conducted on same local machine so , in between network latency is not involved.
I have couple of questions based on above observation:
1. I understand that websocket is doing some protocol specific operations when we call libwebsocket_write() , it does some operations ,calls lws_issue_raw() and then calls send().
My callback is sending data in chunks of 64K , even 32 K also yields the same result.
I want to understand, if websocket does HTTP processing only for handshake and after that, it is supposed to muck only pre-append and post-append buffer , when we send TEXT/BINARY data, then is the overhead of protocol specific operations add on to increase the time of transfer of
buffer data to almost double in comparison to normal socket case.
2. When I send websocket messages all filled with character lets say '5',and capture the same of wireshark, I do not see character 5 in payload of HTTP. Every time, I repeat the experiment it prints different character. When I send Binary data, (use LWS_BINARY) is it supposed to send just binary without any encoding and when I send LWS_TEXT, is it not supposed to send plane text. Is there some kind of encryption or encoding involved for every message sent? If so, is it base64 encoding ? Can I turn off these encoding of data and see what I send on wireshark capture?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets