<legend id='aP51T'><style id='aP51T'><dir id='aP51T'><q id='aP51T'></q></dir></style></legend>

        <bdo id='aP51T'></bdo><ul id='aP51T'></ul>
    1. <i id='aP51T'><tr id='aP51T'><dt id='aP51T'><q id='aP51T'><span id='aP51T'><b id='aP51T'><form id='aP51T'><ins id='aP51T'></ins><ul id='aP51T'></ul><sub id='aP51T'></sub></form><legend id='aP51T'></legend><bdo id='aP51T'><pre id='aP51T'><center id='aP51T'></center></pre></bdo></b><th id='aP51T'></th></span></q></dt></tr></i><div id='aP51T'><tfoot id='aP51T'></tfoot><dl id='aP51T'><fieldset id='aP51T'></fieldset></dl></div>

      1. <small id='aP51T'></small><noframes id='aP51T'>

        <tfoot id='aP51T'></tfoot>

        Masstransit 使用 RabbitMQ 性能很慢?

        时间:2023-08-24

        <i id='ZHpWZ'><tr id='ZHpWZ'><dt id='ZHpWZ'><q id='ZHpWZ'><span id='ZHpWZ'><b id='ZHpWZ'><form id='ZHpWZ'><ins id='ZHpWZ'></ins><ul id='ZHpWZ'></ul><sub id='ZHpWZ'></sub></form><legend id='ZHpWZ'></legend><bdo id='ZHpWZ'><pre id='ZHpWZ'><center id='ZHpWZ'></center></pre></bdo></b><th id='ZHpWZ'></th></span></q></dt></tr></i><div id='ZHpWZ'><tfoot id='ZHpWZ'></tfoot><dl id='ZHpWZ'><fieldset id='ZHpWZ'></fieldset></dl></div>

        <small id='ZHpWZ'></small><noframes id='ZHpWZ'>

        1. <tfoot id='ZHpWZ'></tfoot>

            <legend id='ZHpWZ'><style id='ZHpWZ'><dir id='ZHpWZ'><q id='ZHpWZ'></q></dir></style></legend>
                <tbody id='ZHpWZ'></tbody>

                <bdo id='ZHpWZ'></bdo><ul id='ZHpWZ'></ul>
                • 本文介绍了Masstransit 使用 RabbitMQ 性能很慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在没有 Masstransit 的情况下使用 RabbitMQ,每秒发送 10,000 条消息和 100 秒内发送 100 万条消息.

                  I used RabbitMQ without Masstransit and send 10,000 message/per sec and One million message in 100 second.

                  但是在将 Masstransit 与 RabbitMQ 一起使用后,我的机器上的性能非常低.

                  But after using Masstransit with RabbitMQ the performance is very low in my machine.

                  当发布/消费消息时,硬盘非常活跃(99% 的使用率),并且此进程的 CPU 活动几乎为 0%.

                  The hard disk is very active (99% usage) when publish/consume message and CPU activity for this process is almost 0%.

                  当使用此代码运行发布者/订阅者控制台应用程序时:

                  When the run Publisher/Subscriber console application with this code :

                  var bus = ServiceBusFactory.New(x =>
                  {
                      x.UseRabbitMq();
                      x.ReceiveFrom("rabbitmq://localhost/Example_Hello");
                  });
                  var message = new MyMessage() { Text = "hello", When = DateTime.Now };
                  for (int i = 0; i < 100; i++)
                  {
                      bus.Publish<MyMessage>(message, x => { });
                  }
                  

                  在 6 秒内发布了 100 条消息,我不知道为什么很慢.

                  Published 100 message in 6 second and I don't know why is very slow.

                  我的机器配置和软件版本是:

                  My machine's configuration and software version is:

                  Windows 8.1 64 位

                  Windows 8.1 64bit

                  英特尔酷睿 i3 3.30GHz

                  Intel Core i3 3.30GHz

                  内存 8GB

                  Visual Studio 2013 C#.Net 4.5.1

                  Visual Studio 2013 C#.Net 4.5.1

                  Erlang 6.3

                  RabbitMQ 3.4.4

                  RabbitMQ 3.4.4

                  捷运 2.9.9

                  RabbitMQ.Client 3.4.0

                  RabbitMQ.Client 3.4.0

                  推荐答案

                  这是因为在幕后,MassTransit 正在等待 RabbitMQ 对消息进行 Ack 消息,确保消息被代理成功接受在返回给调用者之前.如果没有这种等待,如果代理无法接收写入,则消息可能会丢失.

                  This is because under the covers, MassTransit is waiting for RabbitMQ to Ack the message, ensuring that it was successfully accepted by the broker before returning to the caller. Without this wait, if the broker fails to receive the write, the message could be lost.

                  使用 MassTransit v3(目前处于预发布状态),Publish 方法(以及所有 Send 方法)现在是异步的,返回一个 Task 可以等待(或者不等待,如果你不关心结果的话).

                  With MassTransit v3 (currently in pre-release), the Publish method (and all Send methods) are now async, returning a Task that can be awaited (or not, if you don't care about the outcome).

                  我可以为 .NET 4.0 开发人员添加一个 PublishAsync 方法到版本 2.9.9,事实上,这就是我最终可能会做的临时解决方法,用于仍然使用当前稳定版本的应用程序.将 NoWait 选项添加到 SendContext 也很有用,允许应用程序选择退出 Ack 等待行为.

                  I could add a PublishAsync method for .NET 4.0 developers to version 2.9.9, in fact, that's what I may end up doing as a temporary workaround for applications still using the current stable version. It may also be useful to add a NoWait option to the SendContext, allowing the application to opt-out of the Ack wait behavior.

                  老实说,在我的用例中,我只是更喜欢持久性而不是性能.

                  I just favor durability over performance in my use case, honestly.

                  这篇关于Masstransit 使用 RabbitMQ 性能很慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 .NET 中使用 RabbitMQ 发布/订阅示例 下一篇:阻止任务在某个线程上运行

                  相关文章

                  最新文章

                • <tfoot id='nqLcQ'></tfoot>

                • <small id='nqLcQ'></small><noframes id='nqLcQ'>

                • <i id='nqLcQ'><tr id='nqLcQ'><dt id='nqLcQ'><q id='nqLcQ'><span id='nqLcQ'><b id='nqLcQ'><form id='nqLcQ'><ins id='nqLcQ'></ins><ul id='nqLcQ'></ul><sub id='nqLcQ'></sub></form><legend id='nqLcQ'></legend><bdo id='nqLcQ'><pre id='nqLcQ'><center id='nqLcQ'></center></pre></bdo></b><th id='nqLcQ'></th></span></q></dt></tr></i><div id='nqLcQ'><tfoot id='nqLcQ'></tfoot><dl id='nqLcQ'><fieldset id='nqLcQ'></fieldset></dl></div>

                    <legend id='nqLcQ'><style id='nqLcQ'><dir id='nqLcQ'><q id='nqLcQ'></q></dir></style></legend>
                      <bdo id='nqLcQ'></bdo><ul id='nqLcQ'></ul>