PATCH:do not set Win32 server-side socket buffer size on windows 2012

Поиск
Список
Период
Сортировка
От chenhj
Тема PATCH:do not set Win32 server-side socket buffer size on windows 2012
Дата
Msg-id 337161aa.1dfd8.14ca2efec52.Coremail.chjischj@163.com
обсуждение исходный текст
Ответы Re: PATCH:do not set Win32 server-side socket buffer size on windows 2012  (Michael Paquier <michael.paquier@gmail.com>)
Re: PATCH:do not set Win32 server-side socket buffer size on windows 2012  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Hi,all

PostgreSQL set Win32 server-side socket buffer size to 32k since 2006, for performance reasons.

While,on the newer version of Windows,such as windows 2012,the default socket buffer size is 64k,
and seem has better performance(high throughput).
So, i propose to apply the attached patch(based on the snapshot of 9.5dev) to  set Win32 server-side
 socket buffer size to 32k only when the default value is less than 32k.


OS default socket buffer size(get from getsockopt(SO_SNDBUF))
Window7:         8k
Windows2003: 8k
Windows2008: 8k
Windows8:       64k
Windows2012: 64k


The following is my performance test for various SO_SNDBUF setting.

Test method:
Use psql to fetch about 100MB data from PostgreSQL(Windows) with various SO_SNDBUF setting.
[chenhj@node2 ~]$ time psql -h dbsvr -p 5432 -U postgres -A -t -c "select '1'::char(10000000),generate_series(1,10)">/dev/null 

real 0m3.295s
user 0m0.222s
sys 0m0.250s


Environment1(default SO_SNDBUF >32k):
Client: PostgreSQL 9.4.1 at RHEL6(x64)
Server: PostgreSQL 9.4.1 at Windows 2012(x64)
Network:1Gbit LAN

Result(execute time):
default(64K),                            1.118s
set SO_SNDBUF to 32K,          3.295s(the current implement)
set SO_SNDBUF to 64K,          2.048s
set SO_SNDBUF to 128K,       1.404s
set SO_SNDBUF to 256K,       1.290s

1)When use Windows as client OS,the result is similar,but there's no "/dev/null" used by my test in windows.
2)I think the reason that the default(64K) is fast than "set SO_SNDBUF to 64K" is
that dynamic send buffering was disabled after set SO_SNDBUF option.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb736549(v=vs.85).aspx
------------------------------------------------------------
Dynamic send buffering for TCP was added on Windows 7 and Windows Server 2008 R2. By default, 
dynamic send buffering for TCP is enabled unless an application sets the SO_SNDBUF socket option on the stream socket.
------------------------------------------------------------
Environment2(default SO_SNDBUF <32k):
Client: PostgreSQL 9.4.1 at RHEL6(x64)
Server: PostgreSQL 9.4.1 at Windows 2008 R2(x64)
Network:1Gbit LAN

Result(execute time):
default(8K),                              7.370s
set SO_SNDBUF to 32K,         4.159s(the current implement)
set SO_SNDBUF to 64K,         2.875s
set SO_SNDBUF to 128K,      1.593s
set SO_SNDBUF to 256K,      1.324s


Best regards,
Chen Huajun
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: SSL information view
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Support UPDATE table SET(*)=...