【问题标题】:Workers and parallelism with Rebus工人和 Rebus 的并行性
【发布时间】:2019-05-15 23:57:18
【问题描述】:

我对以下线程有疑问:

1 以下两种方法的默认值是多少:

2 SetNumberOfWorkers:worker 是专用线程还是通过线程池?

Configure.With(...)
    .(...)
    .Options(o => {
        o.SetNumberOfWorkers(1);
        o.SetMaxParallelism(10);
    })
    .(...)

https://github.com/rebus-org/Rebus/wiki/Workers-and-parallelism

//
// Summary:
//     Configures the total degree of parallelism allowed. This will be the maximum
//     number of parallel potentially asynchrounous operations that can be active, regardless
//     of the number of workers
public void SetMaxParallelism(int maxParallelism);
//
// Summary:
//     Configures the number of workers to start competing over the input queue
public void SetNumberOfWorkers(int numberOfWorkers);

【问题讨论】:

    标签: rebus rebus-azureservicebus


    【解决方案1】:

    Rebus 默认为 1 个单个工作线程,最大并行度为 5——这在 CPU 上很容易,但如果工作是异步的,它仍然可以执行大量工作。

    工作线程是专用线程,用于克服同步 API 传输的限制。

    The wiki page 已相应更新:)

    【讨论】:

    • 谢谢。 worker 和 parallelism 的设置是否可以同时用于 Publiser(入队消息)和 Subscriber(出队消息)?
    • worker/parallelism 设置对发送者/发布者没有任何影响——它仅在接收消息时才相关。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多