ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nginx VS apache: Количество одновременных TCP соединений



On Tue, 22 Aug 2006, Lex Lyamin wrote:

Столкнулся со следующей ситуацией:



Есть некая  html страничка,  достаточно богатая обьектами Content-Type:
image/jpeg.
Есть два сервера отдающих эту страничку и эти  image/jpeg.

Apache case:

Summary,Group,Protocol,Count
Sequence,HTTP,HTTP/1.1 200 OK\r\n,40
Sequence,TCP,Connection establish request (SYN): 29471 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29471,1
Sequence,HTTP,GET /register.php HTTP/1.1\r\n,1
Sequence,HTTP,GET /style/face.css HTTP/1.1\r\n,1
Sequence,HTTP,GET /js/common.js HTTP/1.1\r\n,1
Sequence,HTTP,GET /js/ac_runactivecontent.js HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_introimg- l-brd.jpg HTTP/1.1\r\n,1
Sequence,TCP,Connection establish request (SYN): 29472 -> http,1
Sequence,TCP,Connection establish request (SYN): 29473 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29472,1
Sequence,HTTP,GET /images/tbl-reg_uzor-left-top.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_uzor-left-bottom.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29473,1
Sequence,HTTP,GET /counter?id=1097265;t=55;js=13
;r=;j=true;s=1280*768;d=32;rand=0.10840907616180973 HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): 29471 -> http,1
Sequence,TCP,Connection finish (FIN): http -> 29471,1
Sequence,TCP,Connection establish request (SYN): 29474 -> http,1
Sequence,HTTP,GET /images/users-arrow.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): http -> 29473,1
Sequence,TCP,Connection finish (FIN): 29473 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29474,1
Sequence,HTTP,GET /images/tbl-reg_menu-top.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-top-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/users- arrow-org.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-active-r.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_info-top.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_reg-1.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): http -> 29472,1
Sequence,TCP,Connection finish (FIN): 29472 -> http,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-top-right.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection establish request (SYN): 29475 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29475,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-top-left.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_btn-step2.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-bottom-left.gifHTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-bottom-right.gifHTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-bottom-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-sep-l.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-sep-r.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): 29474 -> http,1
Sequence,TCP,Connection finish (FIN): http -> 29474,1
Sequence,TCP,Connection establish request (SYN): 29476 -> http,1
Sequence,HTTP,GET /images/tbl-mn_uzor-right-top.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29476,1
Sequence,HTTP,GET /images/tbl-reg_introimg-r-brd.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_uzor-right-bottom.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_brd-left2.jpg HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): 29475 -> http,1
Sequence,TCP,Connection finish (FIN): http -> 29475,1
Sequence,TCP,Connection establish request (SYN): 29477 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29477,1
Sequence,HTTP,GET /images/tbl-mn_bg.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-bg.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-active-l.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-active-c.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu- bottom.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-top.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_info-bg.jpg HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): http -> 29476,1
Sequence,TCP,Connection finish (FIN): 29476 -> http,1
Sequence,TCP,Connection establish request (SYN): 29478 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29478,1
Sequence,HTTP,GET /images/tbl-reg_intbl-left.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-bg.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-usi_bg-light.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_brd- right2.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-bottom.gif HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): 29477 -> http,1
Sequence,TCP,Connection finish (FIN): http -> 29477,1

Итого 8 одновременных tcp соединений.
Общее время загрузки страницы - 0.765 sec.


NGINX case:

Summary,Group,Protocol,Count
Sequence,HTTP,HTTP/1.1 200 OK\r\n,40
Sequence,TCP,Connection establish request (SYN): 29536 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29536,1
Sequence,HTTP,GET /register.php HTTP/1.1\r\n,1
Sequence,HTTP,GET /style/face.css HTTP/1.1\r\n,1
Sequence,HTTP,GET /js/common.js HTTP/1.1\r\n,1
Sequence,HTTP,GET /js/ac_runactivecontent.js HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_introimg-l-brd.jpg HTTP/1.1\r\n,1
Sequence,TCP,Connection establish request (SYN): 29537 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29537,1
Sequence,TCP,Connection establish request (SYN): 29538 -> http,1
Sequence,TCP,Connection establish acknowledge (SYN+ACK): http -> 29538,1
Sequence,HTTP,GET /images/tbl-mn_uzor-left-bottom.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_uzor-left-top.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET
/counter?id=1097265;t=55;js=13;r=;j=true;s=1280*768;d=32;rand=
0.213420547460749 HTTP/1.1\r\n,1
Sequence,TCP,Connection finish (FIN): http -> 29538,1
Sequence,TCP,Connection finish (FIN): 29538 -> http,1
Sequence,HTTP,GET /images/tbl-reg_menu-top.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/users-arrow.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu- top-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/users-arrow-org.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-active-r.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_info-top.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_reg-1.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-top-left.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-top-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_btn-step2.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-bottom-left.gifHTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-corner-bottom-right.gifHTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-bottom-right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-sep-l.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-sep-r.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_introimg- r-brd.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_uzor-right-top.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_uzor-right-bottom.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_brd-left2.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_bg.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-bg.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news-active-l.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_news- active-c.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_menu-bottom.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_info-bg.jpg HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-top.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-left.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-bg.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-usi_bg-light.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl- right.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-reg_intbl-bottom.gif HTTP/1.1\r\n,1
Sequence,HTTP,GET /images/tbl-mn_brd-right2.jpg HTTP/1.1\r\n,1

Итого 3 одновременных tcp соединения.
Общее время загрузки страницы - 1.912 sec.


Нужно заметить что время получения одного обьекта с апача и с nginx
приблизительно  относительно одинаковы.
Разница может составлять 0,005 секунды как в ту так и в другую стороны,  что
вполне можно списать на погрешность изменрений.

Отсюда вопрос:
   - кто и исходя из каких данных принимает решение сколько одновременных
tcp cоединений к серверу хочется открывать ?

Решение принимает браузер (какой, кстати ?).
Нужно смотреть возвращаемые заголовки Апача, как минимум.
Для nginx'а я более или мнее представляю, что он может вернуть.


Игорь Сысоев
http://sysoev.ru



 




Copyright © Lexa Software, 1996-2009.