gpt4 book ai didi

postgresql - pgbouncer 错误 : closing because: client unexpected eof (age=0)

转载 作者:IT王子 更新时间:2023-10-29 02:21:56 29 4
gpt4 key购买 nike

我的项目是用golang写的,我使用postgresql数据库,使用pgbouncer作为数据库池连接。完成基本功能后,我进行了压力测试。

通过命令测试运行良好(仅1个并发):

ab -n 1000 -c 1 -p '/home/mwh/postfile.txt' -T 'application/x-www-form-urlencoded' 'http://192.168.1.229:8090/hwSdk/tsk/get_t_k.json'

但是当我增加并发度:

ab -n 10000 -c 100 -p '/home/mwh/postfile.txt1 -T 'application/x-www-form-urlencoded' 'http://192.168.1.229:8090/hwSdk/tsk/get_t_k.json'

应用日志中的数据库查询发生错误:

[2017-06-01 12:04:00]  (pq: bind message supplies 18 parameters, but prepared statement "" requires6) 
[2017-06-01 12:04:00] (pq: bind message supplies 19 parameters, but prepared statement "" requires 3)

在 pgbouncer.log 文件中

8035 2017-06-01 12:04:01.702 45619 LOG C-0xf9a4c0: cygnus/cygnus@192.168.1.229:40397 closing because: client close request (age=0)
8036 2017-06-01 12:04:01.703 45619 LOG C-0xf8b9f0: cygnus/cygnus@192.168.1.229:40406 closing because: client close request (age=0)
8037 2017-06-01 12:04:01.703 45619 LOG C-0xf8b248: cygnus/cygnus@192.168.1.229:40574 login attempt: db=cygnus user=cygnus tls=no
8038 2017-06-01 12:04:01.703 45619 LOG C-0xf8c198: cygnus/cygnus@192.168.1.229:40468 closing because: client close request (age=0
8039 2017-06-01 12:04:01.703 45619 LOG C-0xfac6f0: cygnus/cygnus@192.168.1.229:40504 closing because: client close request (age=0)
8040 2017-06-01 12:04:01.707 45619 LOG C-0xf9e698: cygnus/cygnus@192.168.1.229:40235 closing because: client unexpected eof (age=0)

我的 pgbouncer.ini 设置:

pool_mode = Transaction
listen_port = 6543
listen_addr = *
auth_type = md5
auth_file = /etc/pgbouncer/userlist.txt
logfile = /tmp/pgbouncer.log
pidfile = /tmp/pgbouncer.pid
stats_users = readonly,cygnus
max_client_conn = 2000
default_pool_size = 400
ignore_startup_parameters = extra_float_digits

有什么问题吗?

最佳答案

如果您在 PgBouncer 中使用事务模式,您必须将 binary_parameters=yes 设置为您的数据库 dsn 连接
postgres://user:pass@host:post/db_name?binary_parameters=yes

关于postgresql - pgbouncer 错误 : closing because: client unexpected eof (age=0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44298848/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com