Postgresql日志连接

时间:2013-09-24 06:01:56

标签: postgresql laravel laravel-4 postgresql-9.1

如果我有这个是否正常:

2013-09-24 12:08:24 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:24 WIT LOG:  connection received: host=xx.x.xx.91 port=59878
2013-09-24 12:08:24 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59879
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59880
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59881
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59882
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59883
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.92 port=58015
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx
2013-09-24 12:08:25 WIT LOG:  connection received: host=xx.x.xx.91 port=59885
2013-09-24 12:08:25 WIT LOG:  connection authorized: user=xxxxxx database=xxxx

在我的postgresql-9.1-main.log中?仅供参考,我在postgresql.conf文件中打开了“log_connection”选项,但我想知道我的应用程序(我使用laravel)是否继续使用不同的端口创建连接(可能每秒15次)是正常的吗?

此外,我的应用程序在加载时变得非常。与该日志有任何关系吗?

Laravel或Postgresql问题?提前谢谢。

1 个答案:

答案 0 :(得分:0)

看到这样的日志是一个好兆头。创建新连接需要花费很多。

您可以尝试添加pgPool或pgBouncer(或任何其他中间件)进行连接轮询。但是为了获得最佳性能,您需要在应用程序内部管理连接池。

并不是Postgres问题 - 它没有实现连接池,而是将它留给中间件或应用程序本身。