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 644817 - Slow addressbook cache
Slow addressbook cache
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: Contacts
3.0.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-addressbook-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2011-03-15 11:53 UTC by sean finney
Modified: 2012-01-09 17:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdb backtrace of e-addressbook-factory during issue (6.52 KB, text/plain)
2012-01-06 22:01 UTC, Teraya
  Details
eds patch (12.14 KB, patch)
2012-01-09 17:49 UTC, Milan Crha
committed Details | Review
ema patch (6.08 KB, patch)
2012-01-09 17:52 UTC, Milan Crha
committed Details | Review

Description sean finney 2011-03-15 11:53:25 UTC
Whenever the addressbook factory replicates the GAL for a large organization, the system will have between 1-2 cores completely maxed out, and both evolution and the addressbook factory will use circa 0.5 GB _resident_ memory.  The cores will remain maxed out for approximately 10 minutes, during which evolution is either semi-functional or non-functional (depending on whether it's blocking on waiting to hear back from the factory).  After the 10 minutes, evolution returns to normal though the memory is never released.

While I don't have any solid evidence, I think much of this may be the result of using xml to store/query the "cached" results.  On this client, my current addressbook xml file is ~40MB, for example.

Any reason xml was selected here, as opposed to bdb or maybe sqlite?
Comment 1 Milan Crha 2011-03-15 14:53:08 UTC
Basically because structures provided by evolution-data-server are using XML. Please note of [1] too. When eds will provide better caches, then we can start to use it. I'm moving this to evolution-data-server for now.

[1] http://mail.gnome.org/archives/evolution-hackers/2011-March/msg00030.html
Comment 2 Milan Crha 2011-03-15 14:54:33 UTC
It would be good if you could get a backtrace of the running factory (with evolution-data-server and evolution-mapi debug info packages installed), to see where it is so slow. Thanks in advance.
Comment 3 sean finney 2011-03-15 15:18:18 UTC
The main thread always seems to be waiting on a poll whenever i interrupt it, but there's usually a therad that looks something like this:

  • #0 __strcmp_ssse3
    at ../sysdeps/x86_64/multiarch/../strcmp.S line 2070
  • #1 find_object_in_hash
    at e-file-cache.c line 302
  • #2 foreach_hash_func
    at e-xml-hash-utils.c line 298
  • #3 g_hash_table_foreach
    at ghash.c line 1328
  • #4 e_xmlhash_foreach_key
    at e-xml-hash-utils.c line 319
  • #5 e_file_cache_get_object
    at e-file-cache.c line 326
  • #6 e_book_backend_cache_add_contact
    at e-book-backend-cache.c line 126
  • #7 e_book_backend_mapi_notify_contact_update
    at e-book-backend-mapi.c line 1637
  • #8 fetch_gal_cb
    at e-book-backend-mapi-gal.c line 97
  • #9 exchange_mapi_connection_fetch_gal
    at exchange-mapi-connection.c line 1395
  • #10 ebbm_gal_fetch_contacts
    at e-book-backend-mapi-gal.c line 208
  • #11 ebbm_fetch_contacts
    at e-book-backend-mapi.c line 271
  • #12 ebbm_update_cache_cb
    at e-book-backend-mapi.c line 352
  • #13 g_thread_create_proxy
    at gthread.c line 1897
  • #14 start_thread
    at pthread_create.c line 300
  • #15 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #16 ??

Comment 4 Teraya 2012-01-06 22:01:38 UTC
Created attachment 204786 [details]
gdb backtrace of e-addressbook-factory during issue

This is a gdb "thread apply all bt" of the e-addressbook-factory process, taken while experiencing the high system load.  I notice it because there is nearly constant disk write activity and everything else slows to a crawl.  Our GAL has over 84,000 entries.
Comment 5 Milan Crha 2012-01-09 12:54:18 UTC
Thanks for the update. I was just about to tell that newer evolution-mapi uses SQLite for its cache, but I see from your backtrace that you are actually using it, and this is stuck in SQLite. I'll see whether there is anything which can avoid this slowness.
Comment 6 Milan Crha 2012-01-09 17:49:47 UTC
Created attachment 204893 [details] [review]
eds patch

for evolution-data-server;

Adding new API e_book_backend_sqlitedb_lock_updates(), e_book_backend_sqlitedb_unlock_updates(), which basically begins/ends transaction. Also changed inner transaction locking mechanism, to avoid deadlocks and nested transactions on the SQLite DB.
Comment 7 Milan Crha 2012-01-09 17:52:10 UTC
Created attachment 204894 [details] [review]
ema patch

for evolution-mapi;

Using the new API, to avoid too often commits to SQLite database. There are still committed updates as they go, only not more often than a minute between each commit.
Comment 8 Milan Crha 2012-01-09 17:54:13 UTC
Created commit 6cba5c1 in eds master (3.3.4+)
Created commit 9e7bbb6 in ema master (3.3.4+)