Welcome! Log In Create A New Profile


Multiple requests by upstreams

Posted by nikolayb 
Multiple requests by upstreams
June 20, 2016 05:39AM

How to set up Nginx, so it sent simultaneous requests to different upstream server?

For example:
upstream backend {
     server backend1.example.com;
     server backend2.example.com;
     server backend3.example.com down;
     server backend4.example.com;
     server backend5.example.com;
     server backend6.example.com;

And we need to Nginx when requested in 3 parallel query sent to the backend: backend1.example.com, backend2.example.com, backend4.example.com.
Then, if backend2.example.com returned an error, the request was forwarded to backend5.example.com.

If one of the three queries successfully completed, the client receives the quickest response.

The goal - do not waste time repeating the request to the next server from upstream.
Re: Multiple requests by upstreams
June 20, 2016 05:47AM
You might be able to code this with Lua, but this should work as well:

server backend1.example.com; weight=1 fail_timeout=5;
server backend2.example.com; weight=1 fail_timeout=5;

nginx for Windows http://nginx-win.ecsds.eu/
Re: Multiple requests by upstreams
June 20, 2016 06:09AM
Thank you!
Which configuration should be written on all the upstream servers?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
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