Why is virt so high when create participant

5 posts / 0 new
Last post
Offline
Last seen: 1 year 3 months ago
Joined: 11/29/2022
Posts: 8
Why is virt so high when create participant

I create 2 paricipant in one process。 I found that virt   more than 600M per participant。As shown in the figure circled in red

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

Connext DDS allocates memory based on usage.  Yes, there is a default amount of memory allocated...and on Linux it could be higher than you would think since spawned threads allocated quite a bit of memory for their stack by default, and Connext will spawn at least 6 threads or so per participant (can increase depending on usage).  Any system shared memory segments allocated will also be counted in the virtual memory size.  And then for DataWriters/DataReaders, the history cache is allocated to hold N samples of data...where the size of each sample is the max size of the data type. 

If your data is large and the QOS configuring the DataWriter and DataReader caches (aka send queue/receive queue via RESOURCE_LIMITS Qos) sets large values, then DDS will allocated sufficient memory to hold all of that data.

e.g., Max data size is 10 MB, and ResourceLimits.max_samples = 40, then for a DataWriter or DataReader, DDS will allocated 40*10 MB = 400 MB of memory just for that one entity.

I see by the name of your application, that you may be testing the zerocopy feature of DDS.  Again, any shared memory allocated by Zerocopy is counted in the virtual memory used by the process.

If you want to see how much memory that is only allocated by the DomainParticipant, I suggest you can easily create an application that only creates a single DomainParticipant object and nothing else and see what "top" reports as memory usage.

The rest is due to the DDS objects created by the application code.

Of course, there are QoS parameters that allow you to directly and indirectly control how much memory is allocated, e.g, thread stack size, #samples in the send/recieve queues etc.

 

Offline
Last seen: 1 year 3 months ago
Joined: 11/29/2022
Posts: 8

Howard,Thanks for your quick feedback。

1)i just create only one participant,and set the thread stack size 2*1024*1024,the datawriter and datareader are not created。As shown in the figure circled in red

2)I want to know what QoS parameters that allow to directly and indirectly control how much memory is allocated ,except  thread stack size ;The participaint qos settings are shown in the figure

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

There are other threads created by DDS such as the Database thread and Event thread that you can control the stack size.  Also, if your application does not need to use shared memory, you can disabled the shared memory transport.  Or if your application does not need to use UDP, then you can disabled the builtin UDPv4 transport.   All of these are DomainParticipant QoS values.

              <transport_builtin>
                <mask> SHMEM </mask>
              </transport_builtin>
              <database>
                <thread>
                  <stack_size> 1048576 </stack_size>
                </thread>
              </database>
              <event>
                <thread>
                  <stack_size>1048576</stack_size>
                </thread>
              </event>
              <receiver_pool>
                <thread>
                  <stack_size> 1048576</stack_size>
                </thread>
              </receiver_pool>

There may be other ways to decrease the virtual memory used by a Participant, but the question is how is the memory used for a DomainParticipant affecting your system?  For what reason are you looking to decrease the virtual memory size?

Finally, it's not possible in a forum to teach about all of the different configuration parameters of Connext DDS.  RTI has a Professional Services team that can work with you directly to reduce the memory usage of your Connext DDS application.  If you are interested, I can put you in touch with your local RTI representative.

Offline
Last seen: 1 year 3 months ago
Joined: 11/29/2022
Posts: 8

Howard,Thanks for your quick feedback。

 I understand your statement,mainly related to resource limite or stack size。I'm just curious about why the virt is so high, but I don't need to optimize it directly。

Thanks again