我们正在使用Akka.NET创建一个新系统,并已经设置了基本的群集,包括分片和持久性。我们参考了官方文档和Petabridge博客文章使分片正常工作。但是,我们遇到了一个问题,即分片数超过了SQL Server连接池允许的最大连接数,导致出现以下消息:“Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached。” 我们认为这是在分片更新分片日志时发生的。为什么分片模块没有正确管理其SQL连接?这里是否存在配置问题?当此类错误发生时,是否可能重试以避免消息丢失?以下是相关的HOCON:
cluster.sharding {
journal-plugin-id = "akka.persistence.journal.sharding"
snapshot-plugin-id = "akka.persistence.snapshot-store.sharding"
}
persistence {
journal {
plugin = "akka.persistence.journal.sql-server"
sql-server {
class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
connection-string = "Server=.;Database=akkasystem;Integrated Security=true"
schema-name = dbo
auto-initialize = on
}
# a separate config used by cluster sharding only
sharding {
connection-string = "Server=.;Database=akkasystem;Integrated Security=true"
auto-initialize = on
plugin-dispatcher = "akka.actor.default-dispatcher"
class = "Akka.Persistence.SqlServer.Journal.SqlServerJournal, Akka.Persistence.SqlServer"
connection-timeout = 30s
schema-name = dbo
table-name = ShardingJournal
timestamp-provider = "Akka.Persistence.Sql.Common.Journal.DefaultTimestampProvider, Akka.Persistence.Sql.Common"
metadata-table-name = ShardingMetadata
}
}
snapshot-store {
sharding {
class = "Akka.Persistence.SqlServer.Snapshot.SqlServerSnapshotStore, Akka.Persistence.SqlServer"
plugin-dispatcher = "akka.actor.default-dispatcher"
connection-string = "Server=.;Database=akkasystem;Integrated Security=true"
connection-timeout = 30s
schema-name = dbo
table-name = ShardingSnapshotStore
auto-initialize = on
}
}
}