PGBOUNCER错误:关闭是因为:客户端意外EOF(年龄= 0)



我的项目是用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 Connection
postgres://user:pass@host:post/db_name?binary_parameters=yes

相关内容

  • 没有找到相关文章

最新更新