How do I reduce the DomainParticipant deletion time?

You can speed up participant deletion by decreasing the value of QoS property shutdown_cleanup_period. Before a participant can be deleted it must clean up its internal database. This property specifies the wake up period for the thread that takes care of this.

The default value is set to 1 second, the code below sets it to 10 milliseconds:

<participant_qos>
  <database>
    <shutdown_cleanup_period>
      <sec>0</sec>
      <nanosec>10000000</nanosec> <!--The default value is 1 second-->
    </shutdown_cleanup_period>
  </database>
</participant_qos>



Note that decreasing shutdown_cleanup_period will cause the thread to wake up more often, hence consuming more CPU.

For more information you can read section 8.5.1 DATABASE QosPolicy of the User's Manual.