iTunes server performance

Hi

I have a bit annoying issue with the iTunes server.

Can not play  music seamless in iTunes.

Approx. every 3-4 minutes the playback interrupts, and iTunes has to rebuffer - usally not more than 1 sec or so, but it’s annoying. Sometimes it does more often, sometimes it struggles even for 3-4 secs.

Untitled-2.jpg

After enabling SSH, and examining the running processes, I realized that exactly before iTunes starts to struggle, the forked-daapd process’s CPU usage rockets to 100%.

I don’t really know that it’s just a symptom or it’s the cause.

Untitled-1.gif

I have around 30.000 tracks stored in RAID1, the connection is wired.

Anyone experienced a similar issue?

Cheers, Sebi

I have 960 GB of MP3 files on my mybook live duo, but itunes doesn`t find them. But i am able to play the tracks directly on my mybook live duo. Any idea?

Thks, 

After further investigation I realized that this CPU peak happens in every 5 minutes.

I raised the log level of forked-daapd to warning, and realized that in the same time it will push quite a few warnings in to the /var/log/forked-daapd.log:

[2012-05-04 07:22:49] daap: Could not find requested meta field 'dmap.haschildcontainers'
[2012-05-04 07:22:49] daap: Could not find requested meta field 'com.apple.itunes.saved-genius'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.has-videodaap.songcategory'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'daap.songextradata'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'daap.songgapless'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.gapless-enc-del'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.gapless-heur'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.gapless-enc-dr'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.gapless-dur'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.gapless-resy'
[2012-05-04 07:28:04] daap: Could not find requested meta field 'com.apple.itunes.content-rating'

Is there any scheduled method in forked-daapd, which uses so high CPU the device can’t handle? I’d really appreciate some help here, it basically makes the whole mediaserver unusable, in every song it starts to lag and interrupts the playback for a while. Cheers, Balazs

Even further down the road:

I found a couple of loosly coupled issues in the forked-daapd’s GIT issue tracker, but there’s a common factor, the patch for them involves changing a so called DAAP_UPDATE_REFRESH in the source code, which appears to be exactly 300 sec:

-#define DAAP_UPDATE_REFRESH 300
+#define DAAP_UPDATE_REFRESH 0

Fixes for iTunes v10.5 time-outs.

Response to /update request, always sends database revision number 2

Feature request: keepalive / timeout in forked-daapd.conf

I asked my questions over the github repo’s discussion thread of forked-daapd, and someone replied a senseful answer:

"It seems you are running a version that has a fix applied for the 5 minute disconnect issue. Unfortunately as it looks it is not final one. It rather looks someone applied a quick fix by incrementing the db_rev cylce each update cycle. That does fix the disconnects but comes with a huge downside as it forces a reload of your entire library every 5 minutes. Not unlikely this cause the CPU peaks you are seeing.

If this is the case the solution would be to merge in the final solution and patch available for your platform"

Issue #91: High CPU usage in every 5 minutes · jasonmc/forked-daapd

Actually this is a bit out of my knowledge, maybe someone from WD could take a look on this…

Cheers, Balazs

Thanks for the info. We will look at integrating these changes into the firmware.

Awesome, thanks 

Well, I successfully built forked-daapd on a Debian in Virtual Box, with the following patches applied:

Fixes for iTunes v10.5 time-outs.

Fixes for Amarok and Banshee clients which don’t send

Obviously I didn’t copy all my music to it, so it’s probably not a good test, but it works, I haven’t really seen the forked-daapd process to jump over 0.5% CPU - and also I haven’t seen those lines in the log indicating the reloading of the library.

Also tested the Remote.app pairing, which I couldn’t get to work on the MyBook ( symptoms), and on my build is works flawless.

Sadly I have no idea how to build it for the device itself :slight_smile:

After fighting an afternoon, I managed to re-compile forked-daapd on the device itself, and after running it for ~10 hours, it seems that it doesn’t have the issue. After the inital scan the CPU usage of the media server fell back below 1%, and keeps floating around that value. I book it as a victory :slight_smile:

Sadly the remote pairing is not working, suggesting that it maybe some problem with avahi or so, and not with the forkeed-daapd.