Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?

Started by xbzhangover 12 years ago4 messagesgeneral
Jump to latest
#1xbzhang
xbzhang@kingbase.com.cn

Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ? Can i set it to other value ?
If i extend or decrease it , can it affect the performance of sending message?

张晓博 研发二部
北京人大金仓信息技术股份有限公司
地址:北京市海淀区上地西路八号院上地科技大厦4号楼501
邮编:100085
电话:(010) 5885 1118 - 8450
手机:15311394463
邮箱:xbzhang@kingbase.com.cn

#2Giuseppe Broccolo
giuseppe.broccolo@2ndquadrant.it
In reply to: xbzhang (#1)
Re: Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Il 03/01/2014 09:47, xbzhang ha scritto:

Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?
Can i set it to other value ?

In principle, it is just an arbitrary amount by which to increase the
I/O buffer size. Of course it has to take into account the buffering
behaviour of the system kernel and TCP stack.

If i extend or decrease it , can it affect the performance of
sending message?

PQ_BUFFER_SIZE handle the low-level details of communication between
frontend and backend. I would not decrease its value, there is no
reason to expect advantage splitting 8k buffers (i.e. a page content
size) in my opinion.

Giuseppe.
- --
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe.broccolo@2ndQuadrant.it | www.2ndQuadrant.it
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSxoloAAoJELtGpyN/y3jeaF4P/04JXkTNj3uAd3gmff5y74g2
fOo5xNJG4ZhQ4U3Kp8IumN3UIKAq9bP39ufPL2rQZTDzeoYrhF+tn4gtEFYHKobW
JMpehihpmgC0/vc78FEQu0hZrMH08A8xdY5L+8heoGkOqZIQwMjsmxwcdTLJNdyO
leD933NiiDinXESwXEy3x0LgqaBv11ZeoB6aJgz5jxz95CkpmdSQQwuROYP3nTxy
PnjcjX3rzrC5jvUQS9c5gvOHstwyK/aOWjCI14dygEM6WuwU/jjJoGnSb5SyHUcS
HfNKsjpFnjlaYTYHeQq1mYz3br8JhOZ/akK3FHkuvHKAwhi8wAymAXANm7RUGHZr
nsiv4MyTMIpI6ynA12c7LbIYwlbgoVE+u/dNoyZySNOJv4kkSV5VNMmbwmRLO2GL
ebde35zTn1LjE8LTun/PORiLkG61Xc6+NzjD0PR3yqKklQXPTP/4xoYIxjtg2lp3
dd2ImLhoTE/ruUZpjue75M4XW97jaXKEG2JmdOsOoxJM9UwfXnB9/9DVHJCo5DZk
e4B1YM8xn88MTwoWldC2z4SG3Pg91EU8569nkj1eaudx3LTUm9yNGVCr6tK4Lfd2
SxzEpclytxcFsIO7vQrJK374K/3nYQWb/BmYvIn+iarhY/DDb7TeOjuHUHDualNb
QBoamS6hNuLdNe+il5dM
=2qp+
-----END PGP SIGNATURE-----

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: xbzhang (#1)
Re: Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?

xbzhang <xbzhang@kingbase.com.cn> writes:

Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?

Traditionally, at least, that was the size of pipe buffers in Unix
machines, so in principle this is the most optimal chunk size for
sending data across a Unix socket. I have no idea though if that's
still true in kernels in common use today. For TCP communication
it might be marginally better to find out the MTU size and use that;
but it's unclear that it's worth the trouble, or indeed that we can
know the end-to-end MTU size with any reliability.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Andrew Sullivan
ajs@crankycanuck.ca
In reply to: Tom Lane (#3)
Re: Why the size (PQ_BUFFER_SIZE) of backend send buffers is 8192 ?

On Fri, Jan 03, 2014 at 10:00:42AM -0500, Tom Lane wrote:

know the end-to-end MTU size with any reliability.

Well, you could try PMTU discovery, though I agree that it's not
great. It also seems pretty low-level for something like the DBMS to
be doing.

A

--
Andrew Sullivan
ajs@crankycanuck.ca

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general