Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dds stream threading & participant send/receive buffer size #11560

Merged
merged 8 commits into from
Mar 13, 2023

Conversation

maloel
Copy link
Collaborator

@maloel maloel commented Mar 13, 2023

  • change participant send/receive buffer size for improved performance, otherwise we have dropped frames
  • stream and metadata callbacks are now in own threads

@maloel maloel requested a review from OhadMeir March 13, 2023 08:03
@@ -33,6 +33,7 @@ class dds_subscriber;
//
class dds_topic_reader : public eprosima::fastdds::dds::DataReaderListener
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destructor should be virtual

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -51,7 +51,7 @@ class dds_device::impl
std::queue< nlohmann::json > _option_response_queue;

std::shared_ptr< dds_topic_reader > _notifications_reader;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you not handling notifications in a thread?
There are not a lot of traffic but we parse json and do some other jobs that can take time

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can change, though it may have side-effects -- I'd rather do separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, let me try

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notifications reader has mixed usage, split amongst init() and regular notifications, with the former actually calling wait_for_unread_message. I.e., this complicates things. For now, getting notifications on the eProsima thread while all the rest are using custom threads should be OK.

I think we should push this to another PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. We should monitor CPU usage and option setting delay with high resolution streaming and fix if needed.

@@ -72,7 +73,7 @@ class dds_topic_reader : public eprosima::fastdds::dds::DataReaderListener
};

// The callbacks should be set before we actually create the underlying DDS objects, so the reader does not
void run( qos const & = qos() );
virtual void run( qos const & = qos() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to remove the default parameter. Having default for virtual functions can be error prone because the base default will always be used even if a son changes the default.

We don't use the default in our code now, we pass a parameter everywhere used, and future users can just create the qos object when calling run.

Copy link
Collaborator Author

@maloel maloel Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the base default will always be used

Only if you point to the base.

We don't use the default in our code now

We do... in the watcher, flexible-reader. I'll change them, too...

std::shared_ptr< dds_subscriber > const & subscriber );

// The callbacks should be set before we actually create the underlying DDS objects, so the reader does not
void run( qos const & = qos() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to mark this as override

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

Copy link
Contributor

@OhadMeir OhadMeir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maloel maloel merged commit 8f3c463 into IntelRealSense:dds Mar 13, 2023
@maloel maloel deleted the threads branch March 13, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants