Unexpected pause with satellite doing searches (MPD 20.19)

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
Voxxpop
Posts: 5
Joined: May 14th, 2018, 2:47 pm

Unexpected pause with satellite doing searches (MPD 20.19)

Post by Voxxpop » August 31st, 2018, 8:08 pm

Hi

As a learning excercise I'm writing a simple server in C that controls multiple MPDs and SnapCast servers, and have come across an oddity.
I have the MPDs set up as one (port 6600) being the master, and the rest setup as slaves/satellites (ports 6601,2,3,4).

The library of audio files are mounted at /mnt via SMB on boot, and the master and satellites use music_directory "/mnt" to attach to it.

The satellites use the masters db via (with media being the name of the machine all the MPDs are running on):

Code: Select all

database {
  plugin "proxy"
  host   "media"
  port   "6600"
}
Using libmpdclient2, the following pseudo-code gives the steps I'm doing:

Code: Select all

//<master> is a pointer to an MPD connection struct held in an array.
// The music directory holds c32,000 individual tracks

mpd_search_db_songs(<master>, false);
mpd_search_add_uri_constraint(<master>, MPD_OPERATOR_DEFAULT, "");
mpd_search_add_window(<master>, 4500, 4501);
mpd_search_commit(<master>);
printf("Search commited\n");

mpd_song_tmp = mpd_recv_song(<master>);
printf("Song URI: %s\n", mpd_song_get_uri(mpd_song_tmp));
This gives the expected result - a songs URI is printed. However, changing <master> to one of the satellite connections produces an approx 1s pause between “Search commited” being displayed, and "Song URI..." displaying.

The same result occurs if you use the search command directly via Telnet: on the master it shows the song URI instantly, but via a satellite there is an approx 1s pause between pressing <ENTER> and getting the song URI.

Is this the expected behaviour? If so, is there a way to remove the delay?

I would expect the master and satellite MPDs to each have a permanent (in this case) SMB connection to the music server, and the satellites to have a permanent connection to the master. Assuming the song URI comes from the tag database maintained by the master, I wouldn't expect there to be noticeable difference in getting it directly or via a satellite.

I'd appreciate any input on this as it seems rather odd to me.

Thanks!
Vp

max
Forum team
Posts: 876
Joined: January 15th, 2013, 3:43 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by max » September 1st, 2018, 6:38 am


Voxxpop
Posts: 5
Joined: May 14th, 2018, 2:47 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by Voxxpop » September 1st, 2018, 2:26 pm

Hi

I just spent 3 hours building and installing Debian Unstable on a test PC to compile MPD 0.20.21, and noticed that 0.20.21 has been slipped into their repository, so i upgraded the media machine - hope that's good enough.

Version Info
http://paste.debian.net/1040275/

MPD Conf
http://paste.debian.net/1040276/

MPD1 Conf
http://paste.debian.net/1040277/

MPD Verbose Log from 'search artist "" window 4500:4501' via telnet media 6600
http://paste.debian.net/1040278/
Result: reply printed instantly.

MPD1 Verbose Log from 'search artist "" window 4500:4501' via telnet media 6601
http://paste.debian.net/1040279/
Result: approx 1s pause before reply is printed.

Hope that helps.

Vp

max
Forum team
Posts: 876
Joined: January 15th, 2013, 3:43 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by max » September 1st, 2018, 4:24 pm

You should have the latest MPD on both machines. Any setup which involves an outdated MPD version will not be supported.

But in any case, the "proxy" plugin is currently unable to forward "window" to the next MPD, thus it receives the whole dataset and only then crops the window for its own MPD client. This is my best guess for the delay.

max
Forum team
Posts: 876
Joined: January 15th, 2013, 3:43 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by max » September 2nd, 2018, 2:56 pm

I've started implementing this feature in the master branch. The delay will be gone very soon.

Voxxpop
Posts: 5
Joined: May 14th, 2018, 2:47 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by Voxxpop » September 2nd, 2018, 8:04 pm

Hi

Thanks for that - I was going to ask if it was scheduled to be fixed/implemented.

Vp

max
Forum team
Posts: 876
Joined: January 15th, 2013, 3:43 pm

Re: Unexpected pause with satellite doing searches (MPD 20.19)

Post by max » September 2nd, 2018, 8:39 pm

Done: https://github.com/MusicPlayerDaemon/MP ... 3ee8f247ae
This is git master (to become MPD 0.21).

Post Reply