Sooloos.Broker.Music.LibraryTrack dirty items

Disclaimers

This long wall of text is really aimed at presenting three questions and hoping to get them addressed in a constructive and productive way (=improved Roon user experience):

What can Roon Labs do to improve the experience?
What can Roon Labs do to help me improve the experience?
What can I do to improve the experience?

I’m not really looking for a discussion, although others might benefit from it - I seek answers and improvements. Therefore, this is mainly targeted to the developers who may have the answers and improvements in their hands. Any workarounds or known details from the larger community are, of course, very much welcome!

This is purely from my subjective point of view and does not imply wrong or right: this is just how I feel about this from my use case perspectives. Your’s can (and likely should) be different. I run Roon on an oldish Linux box and use almost exclusively Android devices for Roon Remote. It may or may not be related to this issue, but happens to otherwise work for my needs pretty well. (Further details may be found from my old support requests).

Introduction

Roon provides great value to my music listening and that can’t be over-stated, but if there is one thing that consistently tries to diminish that value and drives me mad, it has to be this log entry (or rather what it represents):

Debug: [query] Sooloos.Broker.Music.LibraryTrack: 3920 dirty items. rebuilding query instead of re-sorting item-by-item (internaltype=LibraryTrack)

Overall, the actual number of dirty items varies per entry (as seem to vary the number of entries per “rebuild”?), but whenever I start seeing those in the log, I know that my active music listening session is ruined and essentially over (or quite frustrating).

Whenever those dreaded entries appear in the log I can expect the following (I used to see these and wonder why, until I found an essentially 100% correlation between these and the log entries mentioned above):

  • one CPU core is at 100%
  • tagging a single track can take minutes
  • accessing albums etc. can also take minutes
  • queued tracks may have 10…120+ second delays in starting
  • UI element animations and actions are delayed by tens of seconds
  • same log entry is logged multiple times
  • this typically happens when I’m actively listening
  • it may last from 5 minutes to hours

As you can imagine, having an hour to spend on listening to new music, liking and tagging the tracks, looking at album/artist details, etc. is quickly spent cursing when all actions start to take minutes while I can’t do anything else but wait.

YES, I NEED BETTER HARDWARE - but I think there is more to it than that.

The Issue

In my very limited understanding and guess work, all of this is a result of some house keeping action on caches in roonserver that requires a CPU heavy optimization to reduce some back end load. Unfortunately, this house keeping action seems to require exclusive access to the internal database, resulting in all other DB access blocking while the house keeping works.

Being a relatively heavy operation, its impact is greatly amplified by low spec hardware and the result is a relatively bad user experience.

I am fairly convinced that this behavior correlates strongly with one or more of the following activities of my “active” listening (which consists mostly of these):

  • first play of a new track in the library
  • liking a track
  • liking an album/artist
  • tagging a track/album

Hardware

Of course, the first entry more or less reveals the “root” cause of these problems: my hardware (old i5) is not enough for roonserver with my library size (ca. 70,000 tracks). However, while a hardware upgrade is already planned, it can only go so far, and reducing bottlenecks on lower end hardware will certainly benefit everybody (to various degrees).

In the extreme end, which I’m nowhere near, improving the software may allow it to scale much further, other issues permitting. So, I think there is at least some value in addressing the issue(s) also on the software side.

Blocking access?

While many of the database access restrictions likely can’t be removed, I think some of them could be reviewed and maybe reconsidered.

The most obvious one is the DB access related to starting the playback of a queued track: is it really required to be able to start the playback or could the DB access/update be queued to be done in the background while the track is already playing? This is a balancing act between playback (user experience), presenting correct up-to-date information about the track (also user experience), and having correct information for tracks in the DB (“play started at …”). Only Roon Labs knows why they need to access the DB before start of each track even if it causes delays. Doing it to check for permission sounds a bit excessive.

As for other use cases, only the user knows for sure whether they require correct up-to-date data or not. An example from my tag management: sometimes I want to check what the track’s tags are (so I would have to wait for the DB access) and at times I simply want to set the tags regardless of what they may have been. Managing tags set for tracks/albums is different from managing what tags exist: first might be done for each track in a library whereas the second might only happen rarely (though I’m not going to anyone to not play with their tags). So, there may be room for improvements regarding tagging of playing (or other) tracks.

As for blocking access on UI elements, I simply can’t understand it and would wish for some sort of an change. A practical example is selecting multiple tracks from a list on my Android tablet Remote: when I long press a track, normally, in some fraction of a second that track is selected, highlighted, and the multiple selection menu and graphical elements appear. However, when the back end is busy, that behavior changes: once the long press is “accepted”, the Remote is likely waiting on back end, but I as user only see what appears to be an interrupted long press (like if my finger moved). So I try again, and again, and again, get frustrated trying, and after some 30-60 seconds the DB access was served, and all of my multiple long press selections go through and the UI updates to show my multiple selections. Absolutely annoying!

Timing

There are two timing related issues in the larger context: doing the heavy blocking activity when the user is active, and on the other hand, reducing the impact of the blocking action.

Let’s look at the logs from my past two days (edited for “brevity” - sorry, I felt the multiple entries contain information that is somehow relevant):

02/23 22:50:18 Sooloos.Broker.Music.LibraryTrack: 2092 dirty
02/23 22:50:19 Sooloos.Broker.Music.LibraryTrack: 2092 dirty
02/23 22:50:39 Sooloos.Broker.Music.LibraryTrack: 11988 dirty
02/23 22:50:40 Sooloos.Broker.Music.LibraryTrack: 11988 dirty
02/23 22:51:00 Sooloos.Broker.Music.LibraryTrack: 12043 dirty
02/23 22:51:01 Sooloos.Broker.Music.LibraryTrack: 12043 dirty
02/23 22:52:02 Sooloos.Broker.Music.LibraryTrack: 7794 dirty
02/23 22:52:03 Sooloos.Broker.Music.LibraryTrack: 7794 dirty
... lots of similar lines removed ...
02/24 00:19:02 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:19:03 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:19:04 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:35:06 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:35:07 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:35:07 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:39:31 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:39:32 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:39:32 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:50:51 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:50:52 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 00:50:53 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
... lots of similar lines removed ...
02/24 01:16:06 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 01:16:07 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 01:16:08 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
... stopped, slept, woke up, started listening & tagging ...
02/24 08:58:01 Sooloos.Broker.Music.LibraryTrack: 9098 dirty
02/24 08:58:01 Sooloos.Broker.Music.LibraryTrack: 9098 dirty
02/24 08:58:02 Sooloos.Broker.Music.LibraryTrack: 9098 dirty
02/24 08:58:42 Sooloos.Broker.Music.LibraryTrack: 9098 dirty
02/24 09:00:38 Sooloos.Broker.Music.LibraryTrack: 10451 dirty
02/24 09:00:39 Sooloos.Broker.Music.LibraryTrack: 10451 dirty
02/24 09:00:40 Sooloos.Broker.Music.LibraryTrack: 10451 dirty
02/24 09:01:20 Sooloos.Broker.Music.LibraryTrack: 10451 dirty
... lots of similar lines removed ...
02/24 11:04:11 Sooloos.Broker.Music.LibraryTrack: 2173 dirty
02/24 11:04:12 Sooloos.Broker.Music.LibraryTrack: 2173 dirty
02/24 11:04:13 Sooloos.Broker.Music.LibraryTrack: 2173 dirty
02/24 11:04:52 Sooloos.Broker.Music.LibraryTrack: 2173 dirty
02/24 11:05:32 Sooloos.Broker.Music.LibraryTrack: 2173 dirty
02/24 11:07:29 Sooloos.Broker.Music.LibraryTrack: 3101 dirty
02/24 11:07:29 Sooloos.Broker.Music.LibraryTrack: 3101 dirty
02/24 11:07:30 Sooloos.Broker.Music.LibraryTrack: 3101 dirty
02/24 11:08:10 Sooloos.Broker.Music.LibraryTrack: 3101 dirty
02/24 11:08:49 Sooloos.Broker.Music.LibraryTrack: 3101 dirty
... stopped actively tagging and listened to another queue ...
... started tagging; lots of similar lines removed ...
02/24 23:46:55 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:46:56 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:46:57 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:47:42 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:48:22 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:48:23 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/24 23:48:24 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
... stopped, slept, woke up, started listening & tagging ...
02/25 08:27:10 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 08:29:43 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 08:42:45 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 08:43:51 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 09:08:30 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 09:13:20 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 09:59:17 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
... lots of similar lines removed ...
02/25 10:46:15 Sooloos.Broker.Music.LibraryTrack: 7630 dirty
02/25 10:47:01 Sooloos.Broker.Music.LibraryTrack: 2405 dirty
02/25 10:47:43 Sooloos.Broker.Music.LibraryTrack: 3601 dirty
02/25 10:48:31 Sooloos.Broker.Music.LibraryTrack: 6452 dirty
02/25 10:49:22 Sooloos.Broker.Music.LibraryTrack: 9676 dirty
02/25 10:50:05 Sooloos.Broker.Music.LibraryTrack: 2287 dirty
02/25 10:50:49 Sooloos.Broker.Music.LibraryTrack: 3102 dirty
02/25 10:51:35 Sooloos.Broker.Music.LibraryTrack: 6220 dirty
02/25 10:52:33 Sooloos.Broker.Music.LibraryTrack: 2609 dirty
02/25 10:53:49 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
02/25 10:56:44 Sooloos.Broker.Music.LibraryTrack: 3920 dirty

If this is some cache related house keeping, then I’m wondering why it happens only when I’m actively liking and tagging tracks (pretty much every track that plays, so on average every 4 minutes or so). Could it be done when I’m not awake or not listening to anything?

If it is related to my activity, then how can liking and tagging a track every four minutes require an i5 to run one core 100% for hours?

Why do the same numbers keep appearing/repeating? Why do the same(?) items keep getting dirty? What is the point of repeatedly doing the same thing(?) again and again? The repeat lines do not look like a regularly intervalled heartbeat: I hope they are are steps from some internal algorithm instead of actually doing the query multiple times!

If these operations do have to run as soon as I’ve happened to trigger them, then could the impact at least be controlled a bit? The log entry says that it is trying to avoid an item-by-item sorting by rebuilding a query, so could the query size be controlled, too? Instead of doing a heavy 10,000 item query, maybe do 10 queries of 1,000 tracks each? If possible, it would increase the granularity, allowing for more frequent DB access for other activities and shorter locking periods. Of course, this does increase back end load, but maybe there is a happy medium for the minimum and maximum “batch” sizes, which could be dynamically tuned based on hardware performance?

Could some of these similar operations be relaxed, delayed, or even outright dropped?

What could Roon do to improve this?

There are all kinds of things Roon might be able to fix regarding this:

  • look for possible bugs related to internal work flows (trigger, clean up, …)
  • decouple UI elements from DB access
  • increase granularity of operations to keep their impact in check
  • possibly delay or reduce some cache updates
  • tolerate eventual consistency where possible without confusing the user

What could Roon do to help users improve this?

The most obvious help comes from increasing awareness and improving related documentation. Options include:

  • what user actions trigger these operations
  • what user choices impact the scale of these operations (=make them worse)
  • provide tools for users to more effectively control the impact of their choices and actions (eg. controlling queue/bookmark/playlist size if relevant)

What could users do to improve this?

In addition to the most obvious and already documented “get better hardware”, users could (once they have the tools and knowledge):

  • adapt usage patterns to reduce overall impact
  • use provided tools and settings to limit the impact
  • report performance anomalies when recognized

The End

THANK YOU FOR READING IT ALL! My apologizies to those who feel robbed of valuable time. Go play some music that resonates with your soul. :slight_smile:

I don’t know if you’ve already seen this:

But seeing yours, always 4 digit figures, this is probably a bit excessive. Maybe your metadata is the issue here in some way (single change affects hundreds and/or thousands of entries)? But in general you’re not alone with your issue (slowness with larger libraries) lately. I’ve seen several threads that might be related and labeled either with “ticket in” or “under investigation”. Let’s see if some official may show up to dive into your issue specifically.

1 Like

I did not see that post with my somewhat limited searches, and normally I’d absolutely agree with that reply: it’s just some internal work that needs to happen. One could maybe make an argument about excessive logging to what is likely an SSD these days: it will wear out more quickly. To me, that is a secondary issue that I can easily workaround if needed.

However, I only found the logs after starting to look at reasons why I was experiencing occasional delays, and so my issue is not really the log entries but the huge delays that come with them. Maybe I would not see them with a more powerful CPU, but eventually, with a growing library, I’d be back at where I am now, so I’d rather try to see some progress with these, regardless.

Anyway, thanks for pointing out the previous forum post addressing pretty much the same thing, except for the performance issues. Hopefully, this gets a decent response, too. :slight_smile:

cheers,
–Artsi

Here are some select timings (or at least that is my impression of what they represent) from the same time period. I only looked for lines with at least 5-7 digits in milliseconds, so anything from 10s up to 9999s.

02/23 06:30:49 Trace: [library] endmutation in 55923ms
02/23 22:50:41 Trace: [library] endmutation in 17191ms
02/23 22:51:01 Trace: [library] endmutation in 16856ms
02/23 22:52:04 Trace: [library] endmutation in 11682ms
02/23 22:52:17 Trace: [library] endmutation in 10598ms
02/23 22:52:33 Trace: [library] endmutation in 13683ms
02/23 22:52:48 Trace: [library] endmutation in 12273ms
02/23 22:53:33 Trace: [library] endmutation in 10734ms
02/23 22:54:30 Trace: [library] endmutation in 13519ms
02/23 22:56:30 Trace: [library] endmutation in 10239ms
02/23 23:55:35 Trace: [library] endmutation in 44395ms
02/23 23:57:11 Trace: [library] endmutation in 45967ms
02/24 00:13:16 Trace: [library] endmutation in 45719ms
02/24 00:19:42 Trace: [library] endmutation in 43093ms
02/24 00:35:47 Trace: [library] endmutation in 44369ms
02/24 00:40:11 Trace: [library] endmutation in 45638ms
02/24 00:51:32 Trace: [library] endmutation in 45680ms
02/24 00:52:19 Trace: [library] endmutation in 44309ms
02/24 01:00:27 Trace: [library] endmutation in 44429ms
02/24 01:02:56 Trace: [library] endmutation in 45743ms
02/24 01:15:12 Trace: [library] endmutation in 44150ms
02/24 01:16:47 Trace: [library] endmutation in 45848ms
02/24 08:59:21 Trace: [library] endmutation in 95158ms
02/24 09:01:59 Trace: [library] endmutation in 96731ms
02/24 09:03:37 Trace: [library] endmutation in 95215ms
02/24 09:05:13 Trace: [library] endmutation in 93489ms
02/24 09:06:43 Trace: [library] endmutation in 86256ms
02/24 09:09:01 Trace: [library] endmutation in 83437ms
02/24 09:10:31 Trace: [library] endmutation in 88256ms
02/24 09:12:02 Trace: [library] endmutation in 86239ms
02/24 09:13:28 Trace: [library] endmutation in 83285ms
02/24 09:15:02 Trace: [library] endmutation in 91837ms
... several similar lines removed ...
02/24 10:15:01 Trace: [library] endmutation in 90191ms
02/24 10:16:36 Trace: [library] endmutation in 85272ms
02/24 10:20:10 Trace: [library] endmutation in 121396ms
02/24 10:22:15 Trace: [library] endmutation in 123350ms
02/24 10:24:19 Trace: [library] endmutation in 121934ms
02/24 10:26:37 Trace: [library] endmutation in 120723ms
02/24 10:28:53 Trace: [library] endmutation in 125539ms
02/24 10:30:58 Trace: [library] endmutation in 124463ms
02/24 10:33:24 Trace: [library] endmutation in 124206ms
02/24 10:35:36 Trace: [library] endmutation in 126094ms
02/24 10:37:49 Trace: [library] endmutation in 124194ms
02/24 10:41:18 Trace: [library] endmutation in 125524ms
02/24 10:46:18 Trace: [library] endmutation in 121777ms
02/24 10:48:37 Trace: [library] endmutation in 127192ms
02/24 10:50:52 Trace: [library] endmutation in 123974ms
02/24 10:53:00 Trace: [library] endmutation in 123393ms
02/24 10:55:08 Trace: [library] endmutation in 123081ms
02/24 10:58:36 Trace: [library] endmutation in 121505ms
02/24 11:01:30 Trace: [library] endmutation in 86807ms
02/24 11:03:21 Trace: [library] endmutation in 86989ms
02/24 11:05:33 Trace: [library] endmutation in 88453ms
02/24 11:08:50 Trace: [library] endmutation in 90177ms
02/24 22:51:29 Trace: [library] endmutation in 136195ms
02/24 23:00:02 Trace: [library] endmutation in 137049ms
02/24 23:11:13 Trace: [library] endmutation in 137235ms
02/24 23:42:52 Trace: [library] endmutation in 137535ms
02/24 23:49:03 Trace: [library] endmutation in 136144ms
02/25 07:51:52 Trace: [library] endmutation in 55407ms
02/25 08:27:49 Trace: [library] endmutation in 39320ms
02/25 08:30:22 Trace: [library] endmutation in 39241ms
02/25 08:43:24 Trace: [library] endmutation in 39180ms
02/25 08:44:31 Trace: [library] endmutation in 40201ms

After the last entry shown, the typical/average value is around 40-45 seconds and continues pretty much the same as the dirty item messages.

It would have been nice to have these with the messages of the original post, but unfortunately the thought only occured after the fact.

Of course, I have no idea if these are really related, but subjectively they correlate with my user experience and so I consider these to be the “run times” of the query rebuilds (possibly until response received?).

Not sure if an i5 to i7 upgrade would be enough to push these 130 second queries down to, say, 5 seconds.

–Artsi

After upgrading Roon Server to 2.0 build 1382, I thought for a moment, that this issue was fixed in the latest version, based on the logs I saw before/after the update (see below). Unfortunately, it might only be a partial fix or just some transient luck (see the next set of logs below).

Here is a sample from the logs before and after the Roon Server update, and as you can see, there was a noticeable change for my typical active listening session:

% egrep -a -oh -e '.* ..:..:.. (Debug.* [0-9]+ dirty |.* endmutation in
[0-9]{5,7}ms)' /var/roon/RoonServer/Logs/RoonServer_log.* | grep -vi transport | sort | tail -50
03/07 16:57:29 Trace: [library] endmutation in 79526ms
[around 9:25PM I setup a queue for active listening and tagging]
03/07 21:25:32 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
03/07 21:26:12 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
03/07 21:26:52 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
03/07 21:26:53 Sooloos.Broker.Music.LibraryTrack: 3920 dirty
03/07 21:26:54 endmutation in 83256ms
03/07 21:43:37 Sooloos.Broker.Music.LibraryTrack: 2449 dirty
03/07 21:44:17 Sooloos.Broker.Music.LibraryTrack: 2449 dirty
03/07 21:44:57 Sooloos.Broker.Music.LibraryTrack: 2449 dirty
03/07 21:44:58 Sooloos.Broker.Music.LibraryTrack: 2449 dirty
03/07 21:44:59 endmutation in 83256ms
03/07 21:45:15 Sooloos.Broker.Music.LibraryTrack: 3489 dirty
03/07 21:45:54 Sooloos.Broker.Music.LibraryTrack: 3489 dirty
03/07 21:46:34 Sooloos.Broker.Music.LibraryTrack: 3489 dirty
03/07 21:46:35 Sooloos.Broker.Music.LibraryTrack: 3489 dirty
03/07 21:46:35 endmutation in 83080ms
03/07 21:46:38 Sooloos.Broker.Music.LibraryTrack: 2591 dirty
03/07 21:47:18 Sooloos.Broker.Music.LibraryTrack: 2591 dirty
03/07 21:47:57 Sooloos.Broker.Music.LibraryTrack: 2591 dirty
03/07 21:47:58 Sooloos.Broker.Music.LibraryTrack: 2591 dirty
03/07 21:47:59 endmutation in 82258ms
03/07 21:48:11 Sooloos.Broker.Music.LibraryTrack: 3413 dirty
03/07 21:48:50 Sooloos.Broker.Music.LibraryTrack: 3413 dirty
03/07 21:49:29 Sooloos.Broker.Music.LibraryTrack: 3413 dirty
03/07 21:49:30 Sooloos.Broker.Music.LibraryTrack: 3413 dirty
03/07 21:49:30 endmutation in 81697ms
03/07 21:49:41 Sooloos.Broker.Music.LibraryTrack: 2712 dirty
03/07 21:50:20 Sooloos.Broker.Music.LibraryTrack: 2712 dirty
03/07 21:50:59 Sooloos.Broker.Music.LibraryTrack: 2712 dirty
03/07 21:51:00 Sooloos.Broker.Music.LibraryTrack: 2712 dirty
03/07 21:51:01 endmutation in 81353ms
03/07 21:51:04 Sooloos.Broker.Music.LibraryTrack: 2255 dirty
03/07 21:51:44 Sooloos.Broker.Music.LibraryTrack: 2255 dirty
03/07 21:52:23 Sooloos.Broker.Music.LibraryTrack: 2255 dirty
03/07 21:52:23 Sooloos.Broker.Music.LibraryTrack: 2255 dirty
03/07 21:52:24 endmutation in 81893ms
03/07 21:52:28 Sooloos.Broker.Music.LibraryTrack: 3003 dirty
03/07 21:53:07 Sooloos.Broker.Music.LibraryTrack: 3003 dirty
03/07 21:53:46 Sooloos.Broker.Music.LibraryTrack: 3003 dirty
03/07 21:53:47 Sooloos.Broker.Music.LibraryTrack: 3003 dirty
03/07 21:53:48 endmutation in 81671ms
[I noticed an update available and upgraded Roon Server]
[I then continued to listen exactly as before until a bit after midnight]
03/07 22:19:35 endmutation in 54948ms
03/07 22:37:24 Sooloos.Broker.Music.LibraryTrack: 2252 dirty
03/07 22:38:04 endmutation in 40659ms
03/07 22:39:16 Sooloos.Broker.Music.LibraryTrack: 7050 dirty
03/07 22:39:56 endmutation in 41626ms
03/07 22:42:43 Sooloos.Broker.Music.LibraryTrack: 2985 dirty
03/07 22:43:23 endmutation in 40764ms
03/07 22:44:31 Sooloos.Broker.Music.LibraryTrack: 4446 dirty
03/07 22:45:11 endmutation in 41150ms
[there was no more entries though I continued to listen for another 90min]

After I noticed the above logs, I was almost sure that the issue had been fixed either deliberately or indirectly through fixing something else. However, today I happened to check the logs again after a morning of passive listening through ARC:

[I focus on tracks for the day and save as a playlist]
[no listening at all]
03/08 07:12:28 endmutation in 41027ms
03/08 07:12:37 Sooloos.Broker.Music.LibraryTrack: 4182 dirty
03/08 07:13:16 Sooloos.Broker.Music.LibraryTrack: 4182 dirty
03/08 07:13:17 endmutation in 41389ms
03/08 07:13:22 Sooloos.Broker.Music.LibraryTrack: 2504 dirty
03/08 07:14:01 Sooloos.Broker.Music.LibraryTrack: 2504 dirty
03/08 07:14:02 endmutation in 40944ms
03/08 07:14:05 Sooloos.Broker.Music.LibraryTrack: 2064 dirty
03/08 07:14:44 Sooloos.Broker.Music.LibraryTrack: 2064 dirty
03/08 07:14:45 endmutation in 40683ms
03/08 07:14:57 Sooloos.Broker.Music.LibraryTrack: 3231 dirty
03/08 07:15:36 Sooloos.Broker.Music.LibraryTrack: 3231 dirty
03/08 07:15:37 endmutation in 41420ms
03/08 07:15:41 Sooloos.Broker.Music.LibraryTrack: 5137 dirty
03/08 07:16:20 Sooloos.Broker.Music.LibraryTrack: 5137 dirty
03/08 07:16:21 endmutation in 41997ms
03/08 07:16:24 Sooloos.Broker.Music.LibraryTrack: 2684 dirty
03/08 07:17:03 Sooloos.Broker.Music.LibraryTrack: 2684 dirty
03/08 07:17:03 endmutation in 40930ms
03/08 07:17:16 Sooloos.Broker.Music.LibraryTrack: 2229 dirty
03/08 07:17:55 Sooloos.Broker.Music.LibraryTrack: 2229 dirty
03/08 07:17:56 endmutation in 41087ms
03/08 07:17:59 Sooloos.Broker.Music.LibraryTrack: 2882 dirty
03/08 07:18:38 Sooloos.Broker.Music.LibraryTrack: 2882 dirty
03/08 07:18:39 endmutation in 41067ms
03/08 07:19:12 Sooloos.Broker.Music.LibraryTrack: 2399 dirty
03/08 07:19:51 Sooloos.Broker.Music.LibraryTrack: 2399 dirty
03/08 07:19:52 endmutation in 40937ms
03/08 07:20:11 Sooloos.Broker.Music.LibraryTrack: 2536 dirty
03/08 07:20:50 Sooloos.Broker.Music.LibraryTrack: 2536 dirty
03/08 07:20:50 endmutation in 40996ms
03/08 07:20:56 Sooloos.Broker.Music.LibraryTrack: 2308 dirty
03/08 07:21:35 Sooloos.Broker.Music.LibraryTrack: 2308 dirty
03/08 07:21:36 endmutation in 41312ms
03/08 07:21:54 Sooloos.Broker.Music.LibraryTrack: 3853 dirty
03/08 07:22:34 Sooloos.Broker.Music.LibraryTrack: 3853 dirty
03/08 07:22:34 endmutation in 41577ms
03/08 07:22:37 Sooloos.Broker.Music.LibraryTrack: 2157 dirty
03/08 07:23:16 Sooloos.Broker.Music.LibraryTrack: 2157 dirty
03/08 07:23:17 endmutation in 41016ms
03/08 07:23:59 Sooloos.Broker.Music.LibraryTrack: 2141 dirty
03/08 07:24:38 Sooloos.Broker.Music.LibraryTrack: 2141 dirty
03/08 07:24:39 endmutation in 40945ms
03/08 07:24:44 Sooloos.Broker.Music.LibraryTrack: 2134 dirty
03/08 07:25:23 Sooloos.Broker.Music.LibraryTrack: 2134 dirty
03/08 07:25:24 endmutation in 40787ms
03/08 07:25:57 Sooloos.Broker.Music.LibraryTrack: 2170 dirty
03/08 07:26:36 Sooloos.Broker.Music.LibraryTrack: 2170 dirty
03/08 07:26:37 endmutation in 41587ms
03/08 07:27:20 Sooloos.Broker.Music.LibraryTrack: 2997 dirty
03/08 07:27:59 Sooloos.Broker.Music.LibraryTrack: 2997 dirty
03/08 07:28:00 endmutation in 41057ms
03/08 07:28:04 Sooloos.Broker.Music.LibraryTrack: 3103 dirty
03/08 07:28:43 Sooloos.Broker.Music.LibraryTrack: 3103 dirty
03/08 07:28:44 endmutation in 41158ms
[I leave home and eventually start ARC playback, just passive listening]
03/08 08:23:18 Sooloos.Broker.Music.LibraryTrack: 11587 dirty
03/08 08:23:57 Sooloos.Broker.Music.LibraryTrack: 11587 dirty
03/08 08:23:57 endmutation in 42305ms
03/08 10:25:14 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 10:25:53 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 10:25:54 endmutation in 40522ms
03/08 11:09:18 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 11:09:57 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 11:09:57 endmutation in 40725ms
03/08 11:37:18 Sooloos.Broker.Music.LibraryTrack: 3965 dirty
03/08 11:37:56 Sooloos.Broker.Music.LibraryTrack: 3965 dirty
03/08 11:37:57 endmutation in 40278ms
03/08 12:03:22 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 12:04:01 Sooloos.Broker.Music.LibraryTrack: 3931 dirty
03/08 12:04:02 endmutation in 40979ms
[This goes on as long as I listen over ARC]

As can be seen from the ARC playback pattern, this is very similar to my original issue. Therefore, it looks like maybe the issue was fixed on the local playback code path, but similar issue exists on the mobile/ARC playback code path, and that has not been fixed?

–Artsi

NOTE: a workaround for avoiding the delays is to restart Roon Server

I spoke too soon about this query delay issue having been fixed. It seems that it simply goes away after a server restart and then slowly builds up again. So, this was not related to playback over ARC (after the 2.0.30 update).

So, I used the following monster to check how many times a single query (based on the number of dirty items) is logged, and then only printed an entry when the count changed, and got this:

cat `ls -1rt /var/roon/RoonServer/Logs/RoonServer_log.*` \
  | grep -a -oh -Ee '.* ..:..:.. (Debug.* [0-9]+ dirty |.* endmutation in [0-9]{4,7}ms|Info: Starting RoonServer)' \
  | grep -vi transport \
  | sed -e 's/Debug: \[query\] //;s/Trace: \[library\] //;s/Info: //' \
  | awk 'BEGIN {cnt=0} /Sooloos/{if (cnt==0) {printf "%s ",$0}; cnt++ } /endmutation/{if (cnt>0) {printf "(x%d)\n",cnt; cnt=0}; } /Starting Roon/{print} END {if (cnt>0) printf "(x%d)\n",cnt}' \
  | awk 'BEGIN {p=""} {if ($6!=p) {print; p=$6}}'

which produced the following unedited output (note that each Sooloos line is the first one of several that in total repeated x times; there may have been tens of entries each repeating 3 times, but only the first of all of those is shown, after which each entry would repeat 4 times for a specific dirty item count and only the first of all those is shown as x4; ie. this shows how the repetition of a single dirty item count changes over time):

03/02 12:16:02 Sooloos.Broker.Music.LibraryTrack: 2305 dirty  (x3)
03/02 12:16:54 Sooloos.Broker.Music.LibraryTrack: 5252 dirty  (x5)
03/02 12:18:35 Sooloos.Broker.Music.LibraryTrack: 2720 dirty  (x3)
03/02 22:59:10 Starting RoonServer
03/02 23:30:35 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x1)
03/03 10:48:45 Sooloos.Broker.Music.LibraryTrack: 4239 dirty  (x2)
03/03 21:53:23 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x4)
03/04 00:00:01 Starting RoonServer
03/04 06:45:16 Sooloos.Broker.Music.LibraryTrack: 11501 dirty  (x1)
03/04 14:19:51 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x3)
03/04 18:23:30 Sooloos.Broker.Music.LibraryTrack: 3994 dirty  (x2)
03/04 21:12:16 Sooloos.Broker.Music.LibraryTrack: 2606 dirty  (x3)
03/05 07:04:54 Sooloos.Broker.Music.LibraryTrack: 11548 dirty  (x5)
03/05 17:08:28 Sooloos.Broker.Music.LibraryTrack: 2348 dirty  (x6)
03/05 21:41:46 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x7)
03/06 06:48:09 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x8)
03/06 19:21:22 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x9)
03/06 20:25:57 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x10)
03/06 21:41:05 Starting RoonServer
03/07 06:44:32 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x2)
03/07 07:16:51 Sooloos.Broker.Music.LibraryTrack: 11587 dirty  (x3)
03/07 21:25:32 Sooloos.Broker.Music.LibraryTrack: 3920 dirty  (x4)
03/07 22:18:34 Starting RoonServer
03/07 22:37:24 Sooloos.Broker.Music.LibraryTrack: 2252 dirty  (x1)
03/08 07:00:23 Sooloos.Broker.Music.LibraryTrack: 11502 dirty  (x2)
03/08 17:40:40 Sooloos.Broker.Music.LibraryTrack: 3931 dirty  (x3)
03/08 21:52:31 Sooloos.Broker.Music.LibraryTrack: 5270 dirty  (x4)
03/09 10:38:49 Sooloos.Broker.Music.LibraryTrack: 3688 dirty  (x5)

Just to give an idea of the latest, more “raw” data, here are the Sooloos lines with likely matching endmutation entries from a 30min period this morning (there is much more). Each repeating line has been “compressed” to just the first instance, with the repeat count after the line:

03/09 10:10:22 Sooloos.Broker.Music.LibraryTrack: 3060 dirty  (x4)
03/09 10:11:43 endmutation in 83998ms
03/09 10:11:46 Sooloos.Broker.Music.LibraryTrack: 2003 dirty  (x4)
03/09 10:13:08 endmutation in 82948ms
03/09 10:13:20 Sooloos.Broker.Music.LibraryTrack: 7389 dirty  (x4)
03/09 10:14:41 endmutation in 87165ms
03/09 10:14:50 Sooloos.Broker.Music.LibraryTrack: 2317 dirty  (x4)
03/09 10:16:11 endmutation in 83320ms
03/09 10:16:20 Sooloos.Broker.Music.LibraryTrack: 2698 dirty  (x4)
03/09 10:17:41 endmutation in 82953ms
03/09 10:17:47 Sooloos.Broker.Music.LibraryTrack: 3124 dirty  (x4)
03/09 10:19:08 endmutation in 83309ms
03/09 10:19:14 Sooloos.Broker.Music.LibraryTrack: 2542 dirty  (x4)
03/09 10:20:35 endmutation in 83426ms
03/09 10:20:46 Sooloos.Broker.Music.LibraryTrack: 5713 dirty  (x4)
03/09 10:22:07 endmutation in 85508ms
03/09 10:22:15 Sooloos.Broker.Music.LibraryTrack: 4624 dirty  (x4)
03/09 10:23:36 endmutation in 84203ms
03/09 10:23:43 Sooloos.Broker.Music.LibraryTrack: 6600 dirty  (x4)
03/09 10:25:05 endmutation in 86401ms
03/09 10:25:11 Sooloos.Broker.Music.LibraryTrack: 2283 dirty  (x4)
03/09 10:26:32 endmutation in 82426ms
03/09 10:27:19 Sooloos.Broker.Music.LibraryTrack: 3162 dirty  (x4)
03/09 10:28:40 endmutation in 83534ms
03/09 10:28:51 Sooloos.Broker.Music.LibraryTrack: 2326 dirty  (x4)
03/09 10:30:10 endmutation in 80919ms
03/09 10:30:20 Sooloos.Broker.Music.LibraryTrack: 5711 dirty  (x4)
03/09 10:31:39 endmutation in 84180ms
03/09 10:31:46 Sooloos.Broker.Music.LibraryTrack: 3701 dirty  (x4)
03/09 10:33:05 endmutation in 81553ms
03/09 10:33:08 Sooloos.Broker.Music.LibraryTrack: 2343 dirty  (x4)
03/09 10:34:26 endmutation in 80446ms
03/09 10:34:43 Sooloos.Broker.Music.LibraryTrack: 2751 dirty  (x4)
03/09 10:36:02 endmutation in 80918ms
03/09 10:36:05 Sooloos.Broker.Music.LibraryTrack: 2346 dirty  (x4)
03/09 10:37:25 endmutation in 81498ms
03/09 10:38:49 Sooloos.Broker.Music.LibraryTrack: 3688 dirty  (x5)
03/09 10:40:46 endmutation in 120870ms

If the above was output like the monster command output before this one, then there would only be the first x4 line, and the first x5 line.

So, the issue is still very much present as reported in the first post of this thread, but the impact can be temporarily minimized by restarting the Roon Server. In my case, the impact of the delays seems to get annoyingly bad in about 24-36 hours, so restarting the server daily may allow for a relatively decent experience (at least for my library size and usage patterns).

–Artsi

Just a quick early update after upgrading Roon Server to 2.0 build 1392 12 hours ago. Only one thing has changed, though quite drastically:

Instead of taking 40/80/90/120/210 seconds to rebuild the queries for the dirty items, it now only takes 1-2 seconds!

Everything else has remained the same:

  • the re-builds show up regularly (maybe one of the triggers is identifying albums in the library)
  • the number of repeated re-builds still starts to go up after a while (based on dirty item count being the same)
  • restarting the server removes the repetition for a while

This is already a major improvement over previous versions as the delays no longer block for significant amounts of time. If there are additional changes that show up over time, I’ll update again, but I don’t expect to be able to say anything concrete until after several days of typical “problematic” use.

–Artsi

In short, the 2.0 build 1392 upgrade did not fix the query re-build issues I’ve been having and documenting here.

The short 1-3 second duration for the re-builds only seem to apply for a few hours after a server restart. After that it is back to the 40/80/whatever seconds per a set of rebuilds, with increasing duration over time. The longest I have seen so far is about 250 seconds (per set) and that mode lasted for roughly three hours non-stop, at which point I simply had to restart the server.

It is also worth noting here, that during these re-build marathons, trying to have ARC connect to the server is quite difficult: it simply does not have enough patience to wait for access. One can only hit “Retry” and hope to be lucky. Half a dozen attempts may be enough, or not.

To me, those initially fast re-build times are insignificant as overall they represent such a small part of my usage patterns. However, build 1392 introduced another improvement, that is actually significant: when the re-builds aren’t there to block access, tagging tracks now only takes 1-3 seconds whereas before it used to be 20-30 seconds for my most often used tag (almost all tracks in the library have that).

This turned out to be a real time saver when the upgrade also lost some 40 albums from my library, which I had to manually re-add, re-like, and re-tag. It “only” took me about an hour to find the albums and add them to the library, and another hour to add the likes and tags back to them. This surprise “clean up of my library”, however, did not affect the dirty items appearing or causing query rebuilds.

–Artsi