gpt4 book ai didi

c# - Signalr SQL 横向扩展 : drawbacks of using multiple streams?

转载 作者:太空狗 更新时间:2023-10-29 23:53:23 25 4
gpt4 key购买 nike

SignalR Performance页面,我们可以阅读:

A Stream in this context is a scale unit used by the scaleout provider; this is a table if SQL Server is used, a Topic if Service Bus is used, and a Subscription if Redis is used. Each stream ensures ordered read and write operations; a single stream is a potential scale bottleneck, so the number of streams can be increased to help reduce that bottleneck. If multiple streams are used, SignalR will automatically distribute (shard) messages across these streams in a way that ensures messages sent from any given connection are in order.

流计数(即 SQL 中的表)可以这样设置:

var connectionString = "(your connection string)";
var config = new SqlScaleoutConfiguration(connectionString) {
TableCount = 3,
MaxQueueLength = 50 };
GlobalHost.DependencyResolver.UseSqlServer(config);

但是 TableCount 在 SQL scaleout 中默认为 1。如果这是规模瓶颈,为什么默认为 1 ?如果我将它设置为 50 会怎么样?

文档没有提供任何线索来决定赋予哪个值。我应该将它设置为 1, 3, 10, 1000 吗? 大值的优点和缺点是什么?它只会增加延迟吗?

最佳答案

来自文档:

https://msdn.microsoft.com/en-us/library/microsoft.aspnet.signalr.sqlscaleoutconfiguration(v=vs.118).aspx

TableCount
Gets or sets the number of tables to store messages in. Using more tables reduces lock contention and may increase throughput. This must be consistent between all nodes in the web farm. Defaults to 1.

关于c# - Signalr SQL 横向扩展 : drawbacks of using multiple streams?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36746863/

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