Welcome! Log In Create A New Profile

Advanced

Re: Optimal nginx settings for websockets sending images

Maxim Dounin
March 01, 2013 08:00AM
Hello!

On Thu, Feb 28, 2013 at 11:06:05PM -0500, michael.heuberger wrote:

> Thanks man :)
>
> > > proxy_buffers 8 2m;
> > > proxy_buffer_size 10m;
> > > proxy_busy_buffers_size 10m;
> >
> > Buffers used looks huge, make sure you have enough memory.
>
> Mmmhhh, do you think I should remove these and trust nginx's default values
> for these buffer?

You should make sure you have enough memory for the buffers
configured. If your system will start swapping - there will
obvious performance degradation compared to smaller buffers.

Default buffers indeed might be better unless you have good
reasons for the buffers sizes set, or you might start with default
sizes and tune them till you are happy with the result. Exact
optimal sizes depend on a particular use case.

> > > 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.
>
> Ok, I changed that to:
> proxy_cache_key "$scheme$host$request_uri";
>
> I also made few additions under location/:
>
> proxy_cache_valid 200 302 304 10m;
> proxy_cache_valid 301 1h;
> proxy_cache_valid any 1m;
>
> proxy_next_upstream error timeout invalid_header http_500 http_502
> http_503 http_504 http_404;
>
> Do you think these are good and justified?

This depends on what and how long you want to cache and how you
would like to handle upstream errors.

> Unfortunately I'm seeing these warnings now:
> "an upstream response is buffered to a temporary file"
>
> Any hints why? Help is much appreciated

The message indicate that an (uncacheable) response was buffered to
a temporary file. It doesn't indicate the problem per se, but
might be useful to track sources of I/O problems. It also might
appear as a side effect from other problems - e.g. if you have
network issues and clients just can't download files requested
fast enough.

If you see such messages it might be just ok if they are rare
enough. Or might indicate that you should configure bigger
buffers (if you have enough memory), or consider disabling disk
buffering.

Try reading here for more information:

http://nginx.org/r/proxy_buffering

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Optimal nginx settings for websockets sending images

michael.heuberger February 25, 2013 10:15PM

Re: Optimal nginx settings for websockets sending images

Maxim Dounin February 26, 2013 07:32AM

Re: Optimal nginx settings for websockets sending images

michael.heuberger February 28, 2013 11:06PM

Re: Optimal nginx settings for websockets sending images

michael.heuberger February 28, 2013 11:08PM

Re: Optimal nginx settings for websockets sending images

Maxim Dounin March 01, 2013 08:00AM

Re: Optimal nginx settings for websockets sending images

michael.heuberger March 01, 2013 11:54PM

Re: Optimal nginx settings for websockets sending images

Maxim Dounin March 03, 2013 07:10AM

Re: Optimal nginx settings for websockets sending images

michael.heuberger March 03, 2013 05:37PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready