[tracker/tracker-store-ipc] The solution to the 2.5s per 10k items: simply lower the priority of the queue



commit 9051f603fffd8428e47c95ea2f6846171accb15c
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu May 28 23:40:49 2009 +0200

    The solution to the 2.5s per 10k items: simply lower the priority of the queue
    
    This is my analysis about this: It was actually clear when Jürg told me did
    his tests without letting the store-queue's idle handler run. My first idea was
    to also disable it for my tests, and then suddenly 10k inserts finished within
    0.135s instead of 2.5s (latter was a quite dissapointing result, former is the
    expected result).
    
    My analysis is the following: the queue's GSource had an equal priority as the
    unix socket's GSource of the GIOChannel.
    
    Meaning that if we lower the priority of the queue's GSource, lower than the
    GSource of the unix socket's GIOChannel, that the latter will run at speed.
    
    With this mini-patch test tests/estress/socket_stress_test.c will finish in
    about 0.135s on an average desktop. The queue will of course have a lot of
    work afterwards, but any subsequent request on the unix-socket (and probably
    also on DBus, as also DBus's GSource now runs at a higher priority that the
    queue's) will get priority.
    
    This allows us to queue 10000 INSERT queries in 0.135s instead of 2.5s and yet
    we don't need to halt or disable the queue itself.
    
    I made this rather large analysis because this apparently is what makes the
    difference in IPC responsiveness for tracker-store's queue design.
---
 src/tracker-store/tracker-store.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 8289305..aa2eed9 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -279,7 +279,7 @@ start_handler (TrackerStorePrivate *private)
 {
 	private->have_handler = TRUE;
 
-	g_idle_add_full (G_PRIORITY_DEFAULT,
+	g_idle_add_full (G_PRIORITY_LOW,
 	                 queue_idle_handler,
 	                 private,
 	                 queue_idle_destroy);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]