[Libwebsockets] performance client vs server

Andy Green andy at warmcat.com
Mon Nov 7 03:40:28 CET 2016


On Mon, 2016-11-07 at 13:12 +1100, jb wrote:
> Using a modified fraggle.c, removing deflate, increasing the message
> size to batches of 32k, removing the generation of random data and
> the checksums, I see that when the client runs at 100% cpu the server
> is only running at 10% cpu. (fraggle.c is arranged so when a client
> connects the server sends a bunch of messages).
> 
> Doing a quick profile it looks like all the client cpu time is taken
> up by lws_client_rx_sm which appears to be a character by
> character state machine for receiving bytes.
> 
> It isn't totally clear to me why the server is 10x faster than the
> client at sending data than the client is at reading data. If the
> server sends a 32k block of zeros as a binary message, at some point
> isn't there a payload length and a payload of 32k does each byte have
> to be processed individually on one side but not the other?

Take a look at this

https://github.com/warmcat/libwebsockets/blob/master/lib/parsers.c#L146
1

On the server side, the equivalent parser got a patch optimizing the
bulk data flow.

If you'd like to port that to the client side, patches are welcome.

-Andy


> thanks.
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets



More information about the Libwebsockets mailing list