1

I am sending messages from various places on my 10G network. I am using a Pub/Sub pattern.

The messages I send are serialized using zeroFormatter and have length of approx 270 bytes.

Once I start to send over 150K message per sec, I notice the subscriber starting to miss messages.

How do I work out what the limits I can expect to be able to send are?

EDIT 1:

I am sending just under 1 billion bits/sec, which is a 10th of the capacity of my network. After this point I start to miss messages. Would this be due to CPU issues? Neither sender or receiver seem highly utilized...

   private void BackgroundProcess()
    {
        int msgSeqNum = 0;
        using (var server = new PublisherSocket())
        {
            server.Options.SendHighWatermark = 1000;
            server.Bind(Connection);


            var address = Key;
            FastTickData fastTickData;
            while (true)
            {

                if (O.TryTake(out fastTickData, 60000))
                {
                    msgSeqNum++;
                    server.SendMoreFrame(address).SendMoreFrame(msgSeqNum.ToString()).SendMoreFrame(DateTime.UtcNow.ToString("yyyyMMddTHHmmssffffff")).SendFrame(ZeroFormatterSerializer.Serialize(fastTickData));
                }

            }

        }
    }
ManInMoon
  • 6,795
  • 15
  • 70
  • 133
  • You might need to increase the high watermark both on the publisher (Send) and Subscriber (Receive). The default is 1000. That mean that the sender will start to discard messages once 1000 messages are in the queue of specific subscriber. For the subscriber, when 1000 messages are in the queue, the subscriber will stop listen to new messages. – somdoron Nov 05 '18 at 16:20
  • It is also depend on how fast you handle the messages. If you produce them faster than you handle them eventually messages are going to be dropped. – somdoron Nov 05 '18 at 16:20
  • It is not about network speed. Set the highwatermark to 0 on both ends and you will not loose any message. However your memory will eventually explode. – somdoron Nov 05 '18 at 16:21
  • Bottom line, if producer produce faster than subscriber can handle, you have a problem and you eventually need to discard messages. If it only a peak, increasing the watermark will solve it. – somdoron Nov 05 '18 at 16:23
  • All my Subscriber does is append the data to a queue, other threads then handle it. Actually, I do deserialize it with zeroFormatter before queuing – ManInMoon Nov 05 '18 at 16:40
  • It might be the issue, anyway calculate your highwatermark acvording to your pick, or disable the watermark. Should solve the problem – somdoron Nov 05 '18 at 18:30
  • OK will try it. Have you used NNanomsg? Just wondering if NetMQ is the right thing for this. – ManInMoon Nov 05 '18 at 19:57
  • Yes, NetMQ can do this easily. You will have this problem doesn't matter which messaging library you use. Your producer is faster than your subscriber. Only two ways to solve this, discarding messages at some point or queue them indefinitely. You can use both pattern with NetMQ – somdoron Nov 05 '18 at 20:49

0 Answers0