How to determine topic size

7 posts / 0 new
Last post
Hassan's picture
Offline
Last seen: 7 years 11 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: 4 days 3 hours ago
Joined: 06/02/2010
Posts: 602

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: 1 year 11 months 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: 2 hours 58 min ago
Joined: 11/29/2012
Posts: 605

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: 1 year 11 months ago
Joined: 08/30/2022
Posts: 4

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

Offline
Last seen: 1 month 2 weeks ago
Joined: 09/17/2024
Posts: 1

 

To determine the size of a topic in RTI Connext DDS, you can follow these steps:

1. **Use the `nddsgen` utility with `-size` option**: When you generate your code using the `rtiddsgen` (or `nddsgen`), you can include the `-size` option, which will provide the size of the topic data structure generated from your IDL file. The command would look like this:
```
rtiddsgen -language C -size your_file.idl
```
This will give you the size of the serialized data type associated with the topic.

2. **Examine the generated code**: The generated `*_type.c` (or `.cpp` if using C++) will have functions for serialization and deserialization of your topic data. These functions use buffers to store the serialized data, and you can infer the size based on buffer allocations.

3. **Use built-in DDS utilities**: Some DDS implementations provide built-in tools or APIs to check the size of serialized topic data. You might want to check if the `DataWriter` and `DataReader` have any built-in methods to measure serialized data size.

4. **Trial run**: Another approach is to send a sample topic and measure the size in the network traffic using tools like Wireshark or RTI's Admin Console to capture and inspect the serialized data.

By using the above methods, you should be able to calculate or retrieve the size of your topic effectively.

 

Howard's picture
Offline
Last seen: 2 hours 58 min ago
Joined: 11/29/2012
Posts: 605

Wow, another AI generated response.  Accurate, but 2 years too late to help the person who originally posted the question.

BTW everyone, RTI does have a AI-powered "chatbot" that endeavors to do the same and provides a powerful facility to get useful answers to your questions about DDS and RTI products.

Check this out: https://chatbot.rti.com/