PDA

View Full Version : iTunes & MusicMagic slowing down?



mherger
2005-08-20, 13:50
Hi!

I'm running slimserver from the trunk with all plugins but
ShoutcastBrowser disabled. But still, when launching the server or going
to the settings page iTunes and MusicMagic both take about 5 seconds to be
loaded/initialized (time measured between "Requiring Plugins::..."
messages). All the other are done well below one second, usually
milliseconds. I think this behaviour must have changed recently. Has there
been a significant change?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

mherger
2005-08-20, 14:38
> I'm running slimserver from the trunk with all plugins but
> ShoutcastBrowser disabled. But still, when launching the server or going
> to the settings page iTunes and MusicMagic both take about 5 seconds to
> be loaded/initialized (time measured between "Requiring Plugins::..."
> messages). All the other are done well below one second, usually
> milliseconds. I think this behaviour must have changed recently. Has
> there been a significant change?

I think it's related to the other issue I mentioned: initPlugin() is
called even though the plugin is disabled. MMM might be looking for the
server connection for some 10 seconds. Removing initPlugin from enabled()
helps a lot!

http://bugs.slimdevices.com/show_bug.cgi?id=2002

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

kdf
2005-08-20, 15:03
On 20-Aug-05, at 1:50 PM, Michael Herger wrote:

> Hi!
>
> I'm running slimserver from the trunk with all plugins but
> ShoutcastBrowser disabled. But still, when launching the server or
> going to the settings page iTunes and MusicMagic both take about 5
> seconds to be loaded/initialized (time measured between "Requiring
> Plugins::..." messages). All the other are done well below one second,
> usually milliseconds. I think this behaviour must have changed
> recently. Has there been a significant change?
>
Musicmagic has always had to wait for a response from the musicmagic
service. To my memory, it has always taken time.
itunes, I'm not sure. It may be because the path to the library was
cached before, and isn't any more. The caching was causing problems,
at least that seemed to be what the comment was indicating.

-kdf

mherger
2005-08-21, 03:12
> Musicmagic has always had to wait for a response from the musicmagic
> service. To my memory, it has always taken time.

MusicMagic has to call initPlugin() at enable() becaus it always has to
add the port field to the plugins settings page - we had discussed this
when I was working on the plugin api. The problem is that initPlugin() and
addCategory() both do far more than it would have to if the plugin is
disabled. initPlugin() does check the port - does it really need to if the
plugin is disabled? And setupCategory() tries to get a filterlist from the
MusicMagic service - definitely not needed when disabled. Both do a http
request which, by default, times out after 5 seconds. Hence the 10 seconds
delay in startup and settings/plugins (+5 when setup groups are created?).

A possible fix might be to check if the plugin is disabled before doing
those http calls. With this patch I'm down from about 20 seconds to <2
seconds when calling settings/plugins. But obviously I've only tested it
withoug MusicMagic :-).

> itunes, I'm not sure. It may be because the path to the library was
> cached before, and isn't any more. The caching was causing problems, at
> least that seemed to be what the comment was indicating.

Dan did some changes last night which fix the delay (and again: I don't
have iTunes neither).

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

dean
2005-08-21, 08:41
Why not make initPlugin safe to call multiple times?


On Aug 21, 2005, at 3:12 AM, Michael Herger wrote:

>> Musicmagic has always had to wait for a response from the
>> musicmagic service. To my memory, it has always taken time.
>>
>
> MusicMagic has to call initPlugin() at enable() becaus it always
> has to add the port field to the plugins settings page - we had
> discussed this when I was working on the plugin api. The problem is
> that initPlugin() and addCategory() both do far more than it would
> have to if the plugin is disabled. initPlugin() does check the port
> - does it really need to if the plugin is disabled? And
> setupCategory() tries to get a filterlist from the MusicMagic
> service - definitely not needed when disabled. Both do a http
> request which, by default, times out after 5 seconds. Hence the 10
> seconds delay in startup and settings/plugins (+5 when setup groups
> are created?).
>
> A possible fix might be to check if the plugin is disabled before
> doing those http calls. With this patch I'm down from about 20
> seconds to <2 seconds when calling settings/plugins. But obviously
> I've only tested it withoug MusicMagic :-).
>
>
>> itunes, I'm not sure. It may be because the path to the library
>> was cached before, and isn't any more. The caching was causing
>> problems, at least that seemed to be what the comment was indicating.
>>
>
> Dan did some changes last night which fix the delay (and again: I
> don't have iTunes neither).
>
> --
>
> Michael
>
> -----------------------------------------------------------
> Help translate SlimServer by using the
> StringEditor Plugin (http://www.herger.net/slim/)
> <mmm.diff>
>

mherger
2005-08-21, 08:53
> Why not make initPlugin safe to call multiple times?

It is, MusicMagic is a special case. It has to call initPlugin from enable
and therefore does things that make no sense if the plugin is disabled.
But it takes several seconds to time out. Normally initPlugin isn't called
for disabled plugins. That's why I thought it should at least be made
"intelligent" enough not to execute those expensive tasks when disabled.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

kdf
2005-08-21, 11:20
On 21-Aug-05, at 3:12 AM, Michael Herger wrote:

>> Musicmagic has always had to wait for a response from the musicmagic
>> service. To my memory, it has always taken time.
>
> MusicMagic has to call initPlugin() at enable() becaus it always has
> to add the port field to the plugins settings page - we had discussed
> this when I was working on the plugin api. The problem is that
> initPlugin() and addCategory() both do far more than it would have to
> if the plugin is disabled. initPlugin() does check the port - does it
> really need to if the plugin is disabled? And setupCategory() tries to
> get a filterlist from the MusicMagic service - definitely not needed
> when disabled. Both do a http request which, by default, times out
> after 5 seconds. Hence the 10 seconds delay in startup and
> settings/plugins (+5 when setup groups are created?).
>
> A possible fix might be to check if the plugin is disabled before
> doing those http calls. With this patch I'm down from about 20 seconds
> to <2 seconds when calling settings/plugins. But obviously I've only
> tested it withoug MusicMagic :-).
>

I missed that critical bit about being disabled. Yes, if the user has
specifically disabled the plugin, it should take the shortest path
possible. skipping all the http calls would be great.

-kdf

mherger
2005-08-21, 12:32
>> A possible fix might be to check if the plugin is disabled before doing
>> those http calls. With this patch I'm down from about 20 seconds to <2
>> seconds when calling settings/plugins. But obviously I've only tested
>> it withoug MusicMagic :-).
>
> I missed that critical bit about being disabled. Yes, if the user has
> specifically disabled the plugin, it should take the shortest path
> possible. skipping all the http calls would be great.

Shall I check in that quick fix or are you already working on a proper
solution?

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

mherger
2005-08-21, 13:35
>> A possible fix might be to check if the plugin is disabled before
>> doing those http calls. With this patch I'm down from about 20 seconds
>> to <2 seconds when calling settings/plugins. But obviously I've only
>> tested it withoug MusicMagic :-).
>
> Go ahead and do that.

Checked in change 4019.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

kdf
2005-08-21, 14:26
On 21-Aug-05, at 12:32 PM, Michael Herger wrote:

>>> A possible fix might be to check if the plugin is disabled before
>>> doing those http calls. With this patch I'm down from about 20
>>> seconds to <2 seconds when calling settings/plugins. But obviously
>>> I've only tested it withoug MusicMagic :-).
>>
>> I missed that critical bit about being disabled. Yes, if the user
>> has specifically disabled the plugin, it should take the shortest
>> path possible. skipping all the http calls would be great.
>
> Shall I check in that quick fix or are you already working on a proper
> solution?
>
its all yours mate :)
-k