Do we need to add parameter to libpq to set the TCP_SYNCNT parameter
От | chenyanfei |
---|---|
Тема | Do we need to add parameter to libpq to set the TCP_SYNCNT parameter |
Дата | |
Msg-id | 1617701405034-0.post@n3.nabble.com обсуждение исходный текст |
Список | pgsql-bugs |
When we use the psycopg2 with green mode, which call postgres async interfaces to make a connection, we ecnouter the conntion time too long when we poweroff the server. Especially, if we use multihost, the connection time is times longer. Through the capture, we find the reason is because of the system parameter tcp_retries2. In my env, the default value is 6, which will cost 127s to give up a connection.(https://github.com/torvalds/linux/blob/master/Documentation/networking/ip-sysctl.rst) If use the sync connection method, I can set the connect_timeout parameter. Through the linux document, I found we can set the tcp_retries2 parameter with the TCP_SYNCNT parameter. So do we need to add parameter TCP_SYNCNT like tcp_user_timeout? >>> conn=psycopg2.connect(database="postgres",user="postgres",host="XXX",port="35432", >>> tcp_user_retry=1); Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.linux-x86_64/egg/psycopg2/__init__.py", line 127, in connect psycopg2.OperationalError: connection to server at "XXX", port 35432 failed: Connection timed out Is the server running on that host and accepting TCP/IP connections? -- Sent from: https://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html
В списке pgsql-bugs по дате отправления: