diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2016-11-05 21:25:50 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-11-20 16:27:46 +0100 |
commit | e53e9da15b660249c798925a64fc2601eb18a458 (patch) | |
tree | b0566ccf86f87125a9f7ba2f0be56af77eb52f51 | |
parent | 648b6603347352e26fed403504667caf2d7fd440 (diff) | |
download | tracker-e53e9da15b660249c798925a64fc2601eb18a458.tar.gz |
libtracker-data: Remove global interface
We no longer need to restrict to a single TrackerDBInterface for the
direct connection use. This also allows to maximize the throughput
in clients performing multiple simultaneous async queries, as we're
going from using a single TrackerDBInterface to satisfy all requests
(with the locking overhead this involves) to using multiple database
connections that can run different concurrent queries each.
This (and the last commits) translates to faster concurrent access,
which evolves close to linearly under much higher loads, instead of
exponentially. It is expected though that O(n^m) happens again if
the number of operations vastly exceed the number of interfaces
serving requests, but that's much farther.
As an example, the numbers when running multiple concurrent queries
for "SELECT ?u WHERE { ?u a rdfs:Resource }" (returning 12897
elements each in this computer) progress like this on an otherwise
idle session:
Simul. Queries With Without
5 0,399s 0,437s
10 0,700s 0,842s
50 3,621s 4,285s
100 7,315s 8,956s
500 36,012s 1m 24,952s
1000 1m 16,355s 8m 33,880s
So as expected the numbers really shine when the thread contention
is most noticeable, and quite close to linearly (eg. in the "with"
column, every row is roughly 10x higher than the one corresponding
to simultaneous queries/10)
-rw-r--r-- | src/libtracker-data/tracker-db-manager.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c index 30e89cfb7..93aed16e5 100644 --- a/src/libtracker-data/tracker-db-manager.c +++ b/src/libtracker-data/tracker-db-manager.c @@ -163,8 +163,6 @@ static guint u_cache_size; static GPrivate interface_data_key = G_PRIVATE_INIT ((GDestroyNotify)g_object_unref); -static TrackerDBInterface *global_iface; - /* mutex protecting DB manager initialization/shutdown */ static GMutex init_mutex; @@ -1200,10 +1198,6 @@ db_manager_init_unlocked (TrackerDBManagerFlags flags, resources_iface = tracker_db_manager_get_db_interfaces (&internal_error, (flags & TRACKER_DB_MANAGER_READONLY) != 0, 1, TRACKER_DB_METADATA); - if (flags & TRACKER_DB_MANAGER_READONLY) { - /* libtracker-direct does not use per-thread interfaces */ - global_iface = resources_iface; - } if (internal_error) { if ((!restoring_backup) && (flags & TRACKER_DB_MANAGER_READONLY) == 0) { @@ -1298,12 +1292,6 @@ db_manager_shutdown_unlocked (void) g_free (user_data_dir); user_data_dir = NULL; - if (global_iface) { - /* libtracker-direct */ - g_object_unref (global_iface); - global_iface = NULL; - } - /* shutdown db interface in all threads */ g_private_replace (&interface_data_key, NULL); @@ -1470,11 +1458,6 @@ tracker_db_manager_get_db_interface (void) g_return_val_if_fail (initialized != FALSE, NULL); - if (global_iface) { - /* libtracker-direct */ - return global_iface; - } - interface = g_private_get (&interface_data_key); /* Ensure the interface is there */ |