简体   繁体   English

Jetty 9.4.26 - websocket 字节消息的 gzip 压缩

[英]Jetty 9.4.26 - gzip compression for websocket byte messages

I am using jetty 9.4.26 with --module=gzip to enable compression on all my server apps.我正在使用带有 --module=gzip 的 jetty 9.4.26 来在我的所有服务器应用程序上启用压缩。 I am sending a lot of byte messages (not strings) to websocket clients (small, but tens of messages per second per client) and I am not sure if the compression is applied to each websocket message, as I noticed an almost double increase in CPU usage (I have not eliminated every possibility but it is the only thing I changed that might have impacted the cpu).我正在向 websocket 客户端发送大量字节消息(不是字符串)(很小,但每个客户端每秒有数十条消息),我不确定是否对每个 websocket 消息应用了压缩,因为我注意到几乎增加了一倍CPU 使用率(我没有消除所有可能性,但这是我更改的唯一可能影响 CPU 的东西)。

And if it does, is there a way to disable gzip for websockets only?如果是这样,有没有办法只为 websockets 禁用 gzip?

Compression of websocket messages is done via the permessage-deflate extension for the websocket conversation itself. websocket 消息的压缩是通过 websocket 对话本身的permessage-deflate扩展完成的。

See: https://stackoverflow.com/a/19300336/775715参见: https : //stackoverflow.com/a/19300336/775715

HTTP gzip compression (which is what --module=gzip enables) is completely unrelated. HTTP gzip 压缩(这是--module=gzip启用的)完全无关。

Keep in mind that websocket is an HTTP upgrade to websocket, once you are upgraded to WebSocket, the HTTP HTTP behaviors are no longer in play.请记住,websocket 是对 websocket 的 HTTP 升级,一旦升级到 WebSocket,HTTP HTTP 行为将不再起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM