【问题标题】:Play framework configuration for connection limit 60 of postgreql on heroku在heroku上玩postgresql的连接限制60的框架配置
【发布时间】:2014-03-24 07:11:08
【问题描述】:

我在 heroku 上设置了三个 Play 2.1.1 应用程序(Api、管理面板和网站),并使用 postgresql 作为数据库。其中,Api 和管理面板正在访问数据库。我设置的 postgresql 包由以下配置组成:

Connection Limit : 60
Row Limit : Unlimited
RAM : 410 MB

我在 Play 应用程序中对 Api 和管理面板中的数据库进行了以下配置:

db.default.url=DATABASE_URL
db.default.partitionCount=1
db.default.maxConnectionsPerPartition=10
db.default.minConnectionsPerPartition=5
db.default.driver="org.postgresql.Driver"
db.default.idleMaxAge=10 minutes
db.default.idleConnectionTestPeriod=30 seconds
db.default.connectionTimeout=20 second
db.default.connectionTestStatement="SELECT 1"
db.default.maxConnectionAge=30 minutes

连接到 BoneCp 数据库时出现超时异常。我只是希望有人验证上述配置是否正确,以便我可以以正确的方式进行调试。 请帮助我。 谢谢。

【问题讨论】:

    标签: postgresql heroku playframework-2.1 heroku-postgres


    【解决方案1】:

    heroku 在 30 秒后关闭所有连接,因此您的 maxConnectionAge 必须低于 30s

    【讨论】:

    • Heroku limits HTTP requests to 30 seconds,但这不适用于数据库连接。如果你的数据库请求超过 30 秒,并且有 HTTP 请求在等待,那么 HTTP 请求就会超时。
    猜你喜欢
    • 2014-01-15
    • 1970-01-01
    • 2012-02-28
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 2012-10-21
    • 2020-03-19
    • 1970-01-01
    相关资源
    最近更新 更多