-
Notifications
You must be signed in to change notification settings - Fork 370
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
How to reduce dds_write time #660
Comments
If you look at where the time is spent, it is spent waiting for Indeed asynchronous writes would help, but it just isn't supported yet. What may help is that all network I/O is inherently asynchronous in most operating systems: one writes the data into a socket send buffer, the kernel transfers it from the socket buffer to the network. Cyclone defaults to a pretty small send buffer, but you can raise it to huge sizes, just like you can with the receive buffer. If you make it large enough to contain the sample, the kernel will do the asynchronous write for you. There are downsides to that: one is that the other outgoing messages get stuck behind it in the buffer (it'll probably survive that with the delays you mention). The other is that it only works if the network is fast enough to keep up with the average rate at which you're trying to send, else you'll just fill up the larger buffer and end up in the same situation (but worse because of that large buffer). Do-it-yourself async writes could be an option (yes ... really ...), if it is a one-off and you can live with a single-place buffer. Then the code to do it asynchronously would be no more than a few lines of code. Or, if you're feeling adventurous, you could take the asynchronous writing that does exist (but that I try not to tell anyone about because it really was just an experiment that made its way out in the initial commit by accident!) and modify it a bit so that it only handles data for some writers and never blocks. If you make |
The main problem was solved! There was a secondary question with no follow-up, please open a new issue if that is something you still want to talk about. |
Hi, I did some test on sending big size buffer using cylclone dds. I hope to reduce the time cost of dds_write.
Your advice is always welcome and appreciated.
here we define 2 different test struct:
1.15MB and 2.448MB
average time:
Max time:
First I am not sure if this is normal range, I hope it is possible to reduce the time because if in a loop it may block the whole process logic.
I use best effort mode and the data lost is allowed.
All data does not need to do serialisation because it is just array, will it help if I disable serialisation?
How to disable serialisation? set //CycloneDDS/Domain/Internal/MaxSampleSize set to 0 b?
If async write mode is supported, that sounds a nice way to solve the problem, but from ros2/rmw_cyclonedds#89
it seems async write is not supported by cyclone dds now.
any other way to reduce write time?
Thanks
The text was updated successfully, but these errors were encountered: