How to determine topic size

5 posts / 0 new
Last post
Hassan's picture
Offline
Last seen: 6 years 2 months ago
Joined: 03/14/2015
Posts: 7
How to determine topic size

Hello Everyone,

                      I have generated my code using rtiddsgen utility through idl file and code is running quite well. Now I am wondering what is the size of my topic. 
I have searched alot about it but could not find out the answer. Can anyone please tell me how I can know the size of topic.

Organization:
Gerardo Pardo's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 06/02/2010
Posts: 600

Hi,

I am not sure what you mean by "the size of my topic". The Topic has an associated data-type (e.g. Foo) and when you use it you end up creating data-objects (e.g. a foo_object) of that data type.

Are you talking about the size of the memory allocated when you create the foo_object. Or are you talking about the size needed to serialize the foo_object into a stream of bytes to send it on the network? Or is it something else?

Either way the type (Foo) does not have a size per se, it is the object (foo_object) that have sizes. For some types all objects may have the same size. But for many other types (e.g. those containing strings or sequences) the size would depend on the specific object.

If you used IDL to define your type, the code generated by rtiddsgen has some utility functions that help figure out some of these sizes. For example for a type FooType you will see these functions:

  • FooTypePlugin_get_serialized_sample_max_size -- Computes the mazimum serialized size of any data-object of type FooType
  • FooypePlugin_get_serialized_sample_size(foo_object) -- COmpute the serialized size of a specific data object (foo_object) of that type

Gerardo

Offline
Last seen: 2 months 2 weeks ago
Joined: 08/30/2022
Posts: 4

I had a similar question and those functions certainly help.  Follow up question:

Where can I learn about sample size limitations w.r.t whether or not the sample can be transmitted in a single UDP packet or multiple?  What happens if a sample is too large to be transmitted atomically? And what tunable parameters might be avaible to control this?

I have access to RTI Academy if there's a good reference, but would also like to find the official documentation on this and examples.

Thanks!

Howard's picture
Offline
Last seen: 1 day 2 hours ago
Joined: 11/29/2012
Posts: 469

A UDP packet can only hold approximately 64 KB (65535) of payload.  When DDS take your data and sends it, it must package it into an RTPS packet, which has headers, as well as other submsgs like timestamps...all of which takes some bytes from the payload.  And so, it's hard to pinpoint the exact number of bytes that a data sample of a DDS Topic would require more than 1 UDP packet to send.

But if your data is 64000 bytes or less, it will be send in a single UDP packet (the overhead is certainly less than 1500 bytes).

If your data requires more than 1 UDP packet to send, Connext DDS will internally fragment your data into multiple UDP packets and reassemble on the receiving end.  You don't have to configure anything...EXCEPT, if you want the data to be sent reliably, RELIABLE Reliability QoS, then your DataWriter must have ASYNCHRONOUS PublishMode.

This is discussed in the Connext User's Manual.  Depending on which version of the manual, the chapter number changed.  In 6.x, it was Chapter 23, but in 7.x, it's now Chapter 34.

 

Offline
Last seen: 2 months 2 weeks ago
Joined: 08/30/2022
Posts: 4

Thank you, Howard.  This is exactly what I was looking for.