nats-streaming-server icon indicating copy to clipboard operation
nats-streaming-server copied to clipboard

Message Size is huge in FIle Store Mode

Open Ansudeen opened this issue 4 years ago • 2 comments

Hi,

I can see the differences in message size between In-memory against File Store mode.

For Example : In - memory i can see message size as "24K" But in File Store for the same messages its shows "130K".

Ansudeen avatar Jan 27 '20 10:01 Ansudeen

Do you have an example on how to reproduce this? There is certainly an overhead with file store since we account for the size of a record header and the corresponding index record for the total of a given message, but that amounts to 40 bytes per message. Here is an example running this publisher command:

go run examples/stan-bench/main.go -np 1 -ns 0 -n 1000 -ms 1024 foo

First with memory store, a capture from http://localhost:8222/streaming/channelsz?subs=1 shows:

"channels": [
    {
      "name": "foo",
      "msgs": 1000,
      "bytes": 1044873,
      "first_seq": 1,
      "last_seq": 1000
    }
  ]

Now restart the server with file store. The same publisher produces now:

  "channels": [
    {
      "name": "foo",
      "msgs": 1000,
      "bytes": 1084873,
      "first_seq": 1,
      "last_seq": 1000
    }
  ]

As you can see the difference is: 1,084,873-1,044,873=40,000, which divided by 1,000 messages amount to 40 bytes.

kozlovic avatar Jan 27 '20 16:01 kozlovic

.. which means that your observation may be correct if messages are actually small, the difference then looks bigger since the overhead per message is more than the size of the message. Still, it will amount to 40bytes per message.

kozlovic avatar Jan 27 '20 16:01 kozlovic