Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Вопрос по перебору бэкендов
Hello!
On Sat, Feb 21, 2009 at 12:57:01AM +0300, Михаил Монашёв wrote:
> Здравствуйте.
>
> Заметил в логах вот такие строчки:
>
> 20/Feb/2009:21:06:23 +0300 502 "502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502" 0.052
> "0.001, 0.001, 0.000, 0.005, 0.001, 0.000, 0.001, 0.000, 0.001, 0.004, 0.001,
> 0.000, 0.001, 0.000, 0.001, 0.003, 0.000, 0.001, 0.000, 0.001, 0.000, 0.003,
> 0.001, 0.000, 0.000, 0.001, 0.000, 0.002, 0.001, 0.000, 0.000, 0.001, 0.000,
> 0.001, 0.001, 0.000, 0.001, 0.000, 0.001, 0.000, 0.001, 0.000, 0.001, 0.000,
> 0.000, 0.001, 0.001, 0.000, 0.001, 0.000, 0.002, 0.000, 0.001, 0.000, 0.001,
> 0.001, 0.001, 0.000, 0.001, 0.000, 0.001, 0.001, 0.001, 0.000, 0.001, 0.000,
> 0.001" "1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 127.0.1.8:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80,
> 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 1.2.3.6:80, 1.2.3.7:80,
> 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 1.2.3.5:80, 1.2.3.6:80, 1.2.3.7:80,
> 1.2.3.8:80, 1.2.3.4:80" 84.42.151.118 354 narutolee.beon.ru "GET / HTTP/1.1"
> "http://images.google.com/imgres?imgurl=http://i61.beon.ru/11/41/94111/92/4044992/461049Naruto_x_Hinata___Rasengan_by_Pia_sama.jpeg&imgrefurl=http://narutolee.beon.ru/&usg=__6dzK7SqWZFVi_5lYbUu2XFwJI0A=&h=366&w=300&sz=39&hl=ru&start=49&um=1&tbnid=8KiGppQD0L0zsM:&tbnh=122&tbnw=100&prev=/images%3Fq%3Dnaruto%26start%3D40%26ndsp%3D20%26um%3D1%26hl
> %3Dru%26sa%3DN" "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.6)
> Gecko/2009011913 Firefox/3.0.6"
>
> 20/Feb/2009:21:06:31 +0300 502 "502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502,
> 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502, 502" 0.065
> "0.001, 0.000, 0.001, 0.002, 0.000, 0.000, 0.001, 0.000, 0.001, 0.002, 0.000,
> 0.000, 0.001, 0.000, 0.001, 0.002, 0.001, 0.000, 0.000, 0.001, 0.000, 0.002,
> 0.000, 0.000, 0.001, 0.000, 0.001, 0.002, 0.000, 0.000, 0.001, 0.001, 0.000,
> 0.002, 0.001, 0.000, 0.000, 0.001, 0.000, 0.002, 0.000, 0.001, 0.000, 0.001,
> 0.000, 0.002, 0.001, 0.000, 0.000, 0.001, 0.000, 0.002, 0.001, 0.000, 0.000,
> 0.001, 0.000, 0.002, 0.001, 0.000, 0.001, 0.000, 0.001, 0.002, 0.001, 0.000,
> 0.001, 0.000, 0.001, 0.002, 0.000, 0.000, 0.001, 0.000, 0.000, 0.002, 0.001,
> 0.000, 0.001, 0.000, 0.001, 0.000, 0.001, 0.000, 0.001, 0.001, 0.000, 0.001,
> 0.000, 0.001, 0.001, 0.000, 0.001, 0.000, 0.001, 0.000, 0.001" "1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 127.0.1.8:80, 1.2.3.6:80,
> 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 1.2.3.6:80, 1.2.3.7:80,
> 1.2.3.8:80, 1.2.3.5:80, 1.2.3.4:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80,
> 1.2.3.5:80, 1.2.3.4:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.5:80,
> 1.2.3.4:80, 1.2.3.5:80, 1.2.3.6:80, 1.2.3.7:80, 1.2.3.8:80, 1.2.3.4:80"
> 92.112.23.162 354 279.beon.ru "GET
> /54-095-test-dlja-devochek-anna-tochno.zhtml HTTP/1.1"
> "http://yandex.ru/yandsearch?text=%D0%BE%D0%BD%D0%BB%D0%B0%D0%B9%D0%BD+%D0%B8%D0%B3%D1%80%D1%8B+%D0%B4%D0%BB%D1%8F+%D0%B4%D0%B5%D0%B2%D0%BE%D1%87%D0%B5%D0%BA+%D0%BD%D0%B0+%D0%BF%D0%BE%D1%86%D0%B5%D0
>
> %BB%D1%83%D0%B8&stpar2=%2Fh1%2Ftm29%2Fs4&stpar4=%2Fs4&stpar1=%2Fu1&stpar3=%2Fm4%2Ftc34%2Fnc1&lr=187"
> "Opera/9.62 (Windows NT 5.1; U; ru) Presto/2.1.1"
>
> Конфигурация апстрима вот такая:
>
> upstream my_backends {
> server 127.0.1.8:80 weight=1 max_fails=20
> fail_timeout=3s;
> server 1.2.3.4:80 weight=5000 max_fails=1000
> fail_timeout=3s;
> server 1.2.3.5:80 weight=10000 max_fails=1000
> fail_timeout=3s;
> server 1.2.3.6:80 weight=16000 max_fails=1000
> fail_timeout=3s;
> server 1.2.3.7:80 weight=16000 max_fails=1000
> fail_timeout=3s;
> server 1.2.3.8:80 weight=16000 max_fails=1000
> fail_timeout=3s;
> server 1.2.3.4:80 backup;
> server 1.2.3.5:80 backup;
> server 1.2.3.6:80 backup;
> server 1.2.3.7:80 backup;
> server 1.2.3.8:80 backup;
> }
>
> Я правильно понимаю, что апстрим знает только про последний
> запрошенный бэкенд и может отправлять один запрос по кругу даже на те
> бэкенды, которые ранее на него вернули ошибку?
Нет, не правильно. В обычных условиях nginx помнит, куда он уже
сходил, и больше туда не ходит. Это бага в реализации backup
серверов.
Maxim Dounin
|