Upstream fail over?
Marcus Clyne
maccaday at gmail.com
Mon Jul 27 05:30:53 MSD 2009
Hi Merlin,
It appears you're trying to do :
HTTP > Nginx > Varnish > (back to Nginx as failsafe) > application.
Apart from the fact that try_files won't work with the config you
mentioned, I think you should probably be trying to use a different
application stack (or at least use them in a different way). One of the
below options are probably better:
HTTP > Varnish > application (Varnish has its own load-balancing
and failover for connections to backends)
HTTP > Varnish > Nginx (load-balancing) > application
HTTP > Varnish > HAProxy > application (HAProxy will typically
out-perform Nginx when all you need to do is to load-balance)
HTTP > HAProxy > Varnish [> HAProxy] > application (Very-high load and
failsafe - only need initial load-balancing with a very large number of
requests per second)
HTTP > Nginx (cache) > application (use the proxy cache feature in
Nginx, proxying to the application with a cache-miss)
If you have a normal load, then probably the first or the last of these
suggestions would probably be best for you. If you will have more than
a couple of application servers, then I would probably recommend the
last (i.e. using Nginx to cache, since I believe Nginx performs
load-balancing better than Varnish at this time, though you can do more
with VCL than you can with Nginx's conf files.
Hope this is useful,
Marcus.
>
>> merlin corey wrote:
>>
>>> Hello,
>>>
>>> Yes, very easily with 0.7.x and above. It would be something like
>>> below ( check http://wiki.nginx.org/NginxHttpCoreModule#try_files )
>>>
>>> location / {
>>> try_files @varnish @application;
>>> }
>>>
>>> location @varnish {
>>> // proxy to varnish
>>> }
>>>
>>> location @application {
>>> // proxy to application
>>> }
>>>
>>> -- Merlin
>>>
More information about the nginx
mailing list