After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772747 - atomicqueue: Improve performance on push operations
atomicqueue: Improve performance on push operations
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 768668 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-10-11 12:19 UTC by sancane
Modified: 2018-11-03 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (4.60 KB, patch)
2016-10-11 12:19 UTC, sancane
none Details | Review
Profiling about the improvement gained with the patch (23.98 KB, image/png)
2016-10-11 12:26 UTC, sancane
  Details
patch (5.00 KB, patch)
2016-10-13 10:58 UTC, sancane
none Details | Review
Test for atomicqueue (3.58 KB, patch)
2016-10-21 14:43 UTC, sancane
none Details | Review

Description sancane 2016-10-11 12:19:40 UTC
Created attachment 337414 [details] [review]
Patch

We have detected that on big pipelines involving a great number of elements and processes competing to post messages on the bus, the amount of time spent on single push operations rapidly increase, we have detected that it can even reach a magnitude of seconds. This issue is caused because the current algorithm forces processes to wait until previous writers finalize sequentially. This patch allow faster writers to finalize the push operation without waiting for slower writers. Those slow processes are responsible of updating the read index so that processes can pop data at the right position, never beyond the index imposed by the slowest writer.
This issue might be related to the bug reported by Miguel París Díaz (https://bugzilla.gnome.org/show_bug.cgi?id=768668opened) who detected a long busy-waiting with gdb.
Comment 1 sancane 2016-10-11 12:26:24 UTC
Created attachment 337415 [details]
Profiling about the improvement gained with the patch

Attached I've add some profiling I've done with and without the patch. When the patch is applied we can scale up to the double of proccesses. The picture show the amount of processes involved on the X axis, and depicted in the y axis it is the time consumed by push operations (measured in nanoseconds).
Comment 2 Tim-Philipp Müller 2016-10-11 13:53:28 UTC
*** Bug 768668 has been marked as a duplicate of this bug. ***
Comment 3 sancane 2016-10-13 10:58:35 UTC
Created attachment 337575 [details] [review]
patch
Comment 4 Sebastian Dröge (slomo) 2016-10-20 12:06:01 UTC
What's this LOW_MEM #ifdef? This definitely needs a very thorough review to not introduce any new race conditions... ideally also more/new tests.
Comment 5 sancane 2016-10-20 12:34:47 UTC
LOW_MEM macro seems to be used to keep the memory as low as possible. When it is defined, array of memory that is not going to be used anymore is freed (taking into account that no readers are using it), without it, tose arrays only will be released when the queue is destroyed. Even it seems to be disabled with the undef statement in the line 52 I tryed to keep the code compatible with this mode of operation.
I completely agree with you that we need more eyes looking at this patch because code is complex and critical. We've been using it at Kurento at it seems to do what is expected to do, anycase, a good test bed will give us enough confidence to grant that no race condition are introduced with it.
Comment 6 sancane 2016-10-21 14:43:33 UTC
Created attachment 338191 [details] [review]
Test for atomicqueue
Comment 7 sancane 2016-10-21 14:47:12 UTC
Hi,
I added some cobeture tests for the atomicqueue. I hope this helps to speed up the inclusion of this enhancement.
Regards.
Comment 8 GStreamer system administrator 2018-11-03 12:36:47 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/192.