Optimal nginx settings for websockets sending images
mdounin at mdounin.ru
Tue Feb 26 12:31:46 UTC 2013
On Mon, Feb 25, 2013 at 10:15:55PM -0500, michael.heuberger wrote:
> The recent nginx 1.3.13 websocket support is fantastic! Big thanks to the
> nginx devs, it works like a charm.
Good to hear. :)
> I only have performance issues. Sending images through websockets turns out
> to be difficult and slow. I have a website sending 5 images per seconds to
> the server.
> Sometimes I have warnings like "an upstream response is buffered to a
> temporary file", then sometimes it's lagging and the server isn't that
This messages are not related to websocket connections, as
websocket connections doesn't do any disk buffering and only use
in-memory buffers. (More specifically, a connection uses two
in-memory buffers with size of proxy_buffer_size - one for
backend-to-client data, and one for client-to-backend data.)
Given the above, I would suppose that you actually have
performance problems unrelated to websockets.
> I'm not sure if my settings for this scenario are optimal. Below you will
> find extracts of my nginx conf files. Maybe you spot some mistakes or have
> proxy_buffers 8 2m;
> proxy_buffer_size 10m;
> proxy_busy_buffers_size 10m;
Buffers used looks huge, make sure you have enough memory.
> proxy_cache one;
> proxy_cache_key "$request_uri|$request_body";
Usuing request body as a cache key isn't really a good idea unless
all request bodies are known to be small.
More information about the nginx