PDA

View Full Version : Softsqueeze Performance Expectations



wyldbill
2005-04-12, 14:44
I've used Softsqueeze for a while as my desktop client, so I can listen while I work, and have had pretty good luck. After upgrading to 6.0.1 however, SS seems to causing performance problems on my machine. If the machine is idle, excepting playing w/ SS, SS keeps my CPU at 100%. It also has a 57MB memory footprint. Running another large application (like Eclipse) causes the machine to bog badly. SS's memory footprint also increases gradually as it runs, indicating that there may be a minor memory leak somewhere.(Weak References are your friend...)

System:
2.4 GHz P IV
XP SP1
2 GB memory (currently no swap)
SServer 6.0.1
SS 6.0b3

I've upped the SS buffer size, which tends to help the CPU load a bit, but other apps are still dogging. I am using the Java MP3 library.

This seems to have started w/ the SS 6.0bX release. Any other similar experiences? Things to look for?

thanks,
-bill

rtitmuss
2005-04-13, 02:07
wyldbill wrote:

>I've used Softsqueeze for a while as my desktop client, so I can listen
>while I work, and have had pretty good luck. After upgrading to 6.0.1
>however, SS seems to causing performance problems on my machine. If the
>machine is idle, excepting playing w/ SS, SS keeps my CPU at 100%. It
>also has a 57MB memory footprint. Running another large application
>(like Eclipse) causes the machine to bog badly. SS's memory footprint
>also increases gradually as it runs, indicating that there may be a
>minor memory leak somewhere.(Weak References are your friend...)
>
>
From your description it sounds like a thread is spinning, if this is
the audio decoder thread it could also explain the memory leak. A new
decoder thread is started for each track played, so if they 'got lost'
then this can cause problems.

For reference, at work using the built in ssh tunneling and decoding
mp3's using the Java MP3 plugin I see a stable memory footprint under
50MB. The CPU is between 3% - 5%. This is running XP SP2, with a 2.6GHz
Athlon and 1 GB memory.

>I've upped the SS buffer size, which tends to help the CPU load a bit,
>but other apps are still dogging. I am using the Java MP3 library.
>
>
I would only expect this to have a very small effect on CPU load. This
buffer you have changed is the javasound audio buffer, so Softsqueeze
performs fewer writes to the audio driver. The maximum limit (imposed
by java) for this buffer is only about twice the size of the default value.

>This seems to have started w/ the SS 6.0bX release. Any other similar
>experiences? Things to look for?
>
>
I completely rewrote the audio layer for Softsqueeze 2.x, to emulate the
Squeezebox2. It would be really useful to know which thread is spinning
and the stack trace of the thread (running Softsqueeze from the command
prompt press Ctrl-Break to get a thread dump), and bonus points for
spotting why :).

Richard

wolfgang_p
2005-04-13, 06:07
Hello,

I also use softsqueeze in my office with SSH to my Home-server.
Starting with Slimserver version 6 sound gets interrupted nearly
each second.

I upgraded to Slimserver version 6.1.0 and Softsqueeze 2.0b3 -
the same problem. My Java Version is 1.5.0_02 and I use the Java
mp3 Plugin. My Notebook is a 900 MHz Celeron with 512MB RAM (Vaio TR1MP). It worked fine with older versions of Server and softsqueeze.

My CPU Load ist low (15%).

Are there some new findings for this situation? Should I load a new nightly build?

Thanks for your help.

Wolfgang

rtitmuss
2005-04-13, 06:20
wolfgang_p wrote:

>Hello,
>
>I also use softsqueeze in my office with SSH to my Home-server.
>Starting with Slimserver version 6 sound gets interrupted nearly
>each second.
>
>I upgraded to Slimserver version 6.1.0 and Softsqueeze 2.0b3 -
>the same problem. My Java Version is 1.5.0_02 and I use the Java
>mp3 Plugin. My Notebook is a 900 MHz Celeron with 512MB RAM (Vaio
>TR1MP). It worked fine with older versions of Server and softsqueeze.
>
>My CPU Load ist low (15%).
>
>Are there some new findings for this situation? Should I load a new
>nightly build?
>
>Thanks for your help.
>
>Wolfgang
>
>
>
I think this is an easy one to fix :). During the upgrade Softsqueeze
will have reset it's preferences, causing it to appear as a new player
in the slimserver. You need to set the bandwidth limit for Softsqueeze
in the player preferences in the slimserver.

Richard

wolfgang_p
2005-04-13, 10:28
Thank You for Your answer.
I tried it and reduced the max. bandwith in steps down to 64kb/s. First it seemed to go better, but after some ten seconds the audio stuttered again every second or so.

To proof, that it is not a bandwidth problem from my home-server or my work network I did a ssh connection and dowloaded a mp3 file from home to work with ftp. The average and steady donwload speed was around 22kByte/s. So that should be around 256kbit/s, but at least more than 200kbit/s.

With my old softsqueeze I never had set a bandwidth-limit and it worked.

Any Idea or anyhting else I can try?

Thanks

Wolfgang

wyldbill
2005-04-13, 11:03
It would be really useful to know which thread is spinning
and the stack trace of the thread (running Softsqueeze from the command
prompt press Ctrl-Break to get a thread dump), and bonus points for
spotting why :).

Richard

as requested, thread dump is attached.

It takes a while to get into this state. At least 30 min (~6 tracks), exact time, I don't know, as I went to a meeting. The memory wasn't so bad this time, but CPU usage did spin up to whatever was allowed. Pausing the player did pause the output, but had no impact on CPU utilization (which should indicate there's an unused thread spinning). From the dump, it looks like only
"SlimTCP-2" prio=7 tid=0x072cdb10 nid=0x1204 runnable [797f000..797fd8c]
"SlimUDP-0" prio=5 tid=0x072c3470 nid=0xd80 runnable [773f000..773fd8c]
"AWT-Windows" daemon prio=7 tid=0x02e56850 nid=0x1354 runnable [71af000..71afd8c]
aren't waiting on an Object lock or condition.

"AudioDecoder-16" daemon prio=7 tid=0x02cb3948 nid=0x12b0 waiting on condition [7abf000..7abfd8c]

is suspicious because

"AudioDecoder-18" daemon prio=7 tid=0x02d4c0d8 nid=0x70c in Object.wait() [7aff000..7affd8c]

exists. What happened to 17? Why is 16 waiting on a StringBuffer.toString() call? This seems like odd behavior for an AudioDecoder to be locked on. This is a daemon thread, which seems strange as well. Perhaps not cleaned up appropriately. Might be worth the time to stick a logging finalize() in this class to see when they're getting cleaned up...

FWIW,
-bill

wyldbill
2005-04-13, 11:33
Happened again, and quickly this time....

"AudioDecoder-2" daemon prio=5 tid=0x02d95e78 nid=0x1714 in Object.wait() [7aff000..7affd8c]
at java.lang.Object.wait(Native Method)
- waiting on <0x106a4088> (a com.slim.softsqueeze.audio.AudioBuffer)
at java.lang.Object.wait(Object.java:429)
at com.slim.softsqueeze.audio.AudioBuffer.write(Audio Buffer.java:275)
- locked <0x106a4088> (a com.slim.softsqueeze.audio.AudioBuffer)
at com.slim.softsqueeze.audio.AudioDecoder.decodeFram e(AudioDecoder.java:336)
at com.slim.softsqueeze.audio.AudioDecoder.run(AudioD ecoder.java:313)
at java.lang.Thread.run(Thread.java:534)

"AudioStream-2" daemon prio=5 tid=0x072e8c00 nid=0x1304 in Object.wait() [797f000..797fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <0x10ebbb80> (a com.slim.softsqueeze.audio.AudioBuffer)
at java.lang.Object.wait(Object.java:429)
at com.slim.softsqueeze.audio.AudioBuffer.write(Audio Buffer.java:223)
- locked <0x10ebbb80> (a com.slim.softsqueeze.audio.AudioBuffer)
at com.slim.softsqueeze.audio.AudioStream.run(AudioSt ream.java:76)
at java.lang.Thread.run(Thread.java:534)

"AudioDecoder-0" daemon prio=5 tid=0x072f4520 nid=0xfc runnable [79bf000..79bfd8c]
at java.lang.Thread.yield(Native Method)
at com.sun.media.codec.audio.mp3.JS_MP3DecoderStream. decodeNextFrame(JS_MP3DecoderStream.java:195)
at com.sun.media.codec.audio.mp3.JS_MP3DecoderStream. read(JS_MP3DecoderStream.java:146)
- locked <0x10d64f38> (a com.sun.media.codec.audio.mp3.JS_MP3DecoderStream)
at com.slim.softsqueeze.audio.AudioDecoder.decodeFram e(AudioDecoder.java:332)
at com.slim.softsqueeze.audio.AudioDecoder.run(AudioD ecoder.java:313)
at java.lang.Thread.run(Thread.java:534)


Looks like AudioDecoder-0 doesn't know that it's done decoding.

No AudioDecoders subsequent to that have been cleaned up either. I have 0,2,3,4 hanging around at this point (1 did get cleaned up...)

One idea is to not make these deamons, but manage them directly. If you can go to Java 1.5 (Tiger) there's some great new stuff in java.util.concurrent for pooling and managing threads.

-bill

rtitmuss
2005-04-13, 12:14
On 13 Apr 2005, at 19:33, wyldbill wrote:

>
> Happened again, and quickly this time....

Thanks, I'll look at this a little later this evening.

> Looks like AudioDecoder-0 doesn't know that it's done decoding.
>
> No AudioDecoders subsequent to that have been cleaned up either. I have
> 0,2,3,4 hanging around at this point (1 did get cleaned up...)

I don't understand what's different that is making this fail for you.
Is your PC using hyperthreading?

> One idea is to not make these deamons, but manage them directly. If you
> can go to Java 1.5 (Tiger) there's some great new stuff in
> java.util.concurrent for pooling and managing threads.
>

Yes, I was wondering on the way to working this morning why I made each
decoder a separate thread, instead of just reusing a single thread. At
the time I think I was allowing two decoders to run in parallel for
crossfading, although in practice this would never happen now (and I
have not implemented crossfading in Softsqueeze yet). If it did use a
single decoder thread then I think this bug would cause the audio to
stop altogether, instead of spinning the cpu - not much better!

I do use some Java 1.5 UI features in Softsqueeze, but cannot use the
new features in the core. In theory Softsqueeze should work on the MS
Java 1.3 VM as an applet, and Java 1.4 is needed for OS X support.

Richard

wyldbill
2005-04-13, 12:52
I don't understand what's different that is making this fail for you.
Is your PC using hyperthreading?
Richard
Dont' think so. This machine is at least two years old. 2.26GHZ P IV. Hm... Found a Proc ID app on Intel. Not Hyperthreading.



If it did use a
single decoder thread then I think this bug would cause the audio to
stop altogether, instead of spinning the cpu - not much better!
Richard
But much easier to debug ;)

Does the classpath order make any difference? In other words, have you created any classes with identical names to others in the classpath?

thanks,
-bill

rtitmuss
2005-04-13, 15:59
Does the classpath order make any difference? In other words, have you created

No.

I have found that I can recreate this bug on my iBook. I've attached (in the forum) a version of Softsqueeze with some additional debug enabled by default. Could you please try this version and let me know if it works for you.


[ OK it is too big to attach. Try downloading it from http://softsqueeze.sourceforge.net/SoftSqueeze.jar ]


From your stack traces and my debugging tonight it looks like the Java MP3 Plugin library is spinning when the stream is closed. At the moment I assume it is waiting to complete an mp3 frame, therefore the question is why is the stream cut short?

I have found an off by one error in the Softsqueeze audio buffer, but have run out of time to do more testing now (it's bedtime here in the uk!). If this version does not fix the problem, could you try using jlayer to decode the mp3. I think this will work ok.

Richard

wyldbill
2005-04-13, 17:57
{snip}I've attached (in the forum) a version of Softsqueeze with some additional debug enabled by default. Could you please try this version and let me know if it works for you.
[ OK it is too big to attach. Try downloading it from http://softsqueeze.sourceforge.net/SoftSqueeze.jar ]
Richard
Tried the .jar. It insists on SlimServer 6.1 and exits. I'm running 6.0.1 (which is current).

-bill

kdf
2005-04-13, 18:04
Quoting wyldbill <wyldbill.1ngei0 (AT) no-mx (DOT) forums.slimdevices.com>:

>
> rtitmuss Wrote:
> > {snip}I've attached (in the forum) a version of Softsqueeze with some
> > additional debug enabled by default. Could you please try this version
> > and let me know if it works for you.
> > [ OK it is too big to attach. Try downloading it from
> > http://softsqueeze.sourceforge.net/SoftSqueeze.jar ]
> > Richard
> Tried the .jar. It insists on SlimServer 6.1 and exits. I'm running
> 6.0.1 (which is current).

There are two streams of nightly builds. One is now marked as 6.0.2 and the
other is marked as 6.1. You can choose which one here:

http://www.slimdevices.com/downloads/nightly/latest/

-kdf

rtitmuss
2005-04-14, 15:20
wyldbill wrote:

>rtitmuss Wrote:
>
>
>>{snip}I've attached (in the forum) a version of Softsqueeze with some
>>additional debug enabled by default. Could you please try this version
>>and let me know if it works for you.
>>[ OK it is too big to attach. Try downloading it from
>>http://softsqueeze.sourceforge.net/SoftSqueeze.jar ]
>>Richard
>>
>>
>Tried the .jar. It insists on SlimServer 6.1 and exits. I'm running
>6.0.1 (which is current).
>
>-bill
>
>
>
>
Ah, sorry about that. I have just checked into the 6.0.x branch a
Softsqueeze update (version 2.0b5). Based on my testing tonight I don't
think it will have solved your problem, this build has worked fine on my
XP desktop, but suffers high cpu usage on my iBook. It is worth you
trying to use jlayer instead of the mp3 plugin.

Richard

rtitmuss
2005-04-14, 15:29
wolfgang_p wrote:

>Thank You for Your answer.
>I tried it and reduced the max. bandwith in steps down to 64kb/s. First
>it seemed to go better, but after some ten seconds the audio stuttered
>again every second or so.
>
>Any Idea or anyhting else I can try?
>
>
Could you try enabling 'player' and 'player verbose' debug in the
Softsqueeze preferences, and send me the output.

Thanks,
Richard

chrisla
2005-12-21, 23:39
Did this memory leak ever get resolved?

I seem to be having a similar problem:

Exception in thread "AudioDecoder-1" java.lang.OutOfMemoryError: Java heap space

I already had my Max Heap size set to 128M, I have upped it to 256 to
see if the situation changes any.

With the mp3plugin SoftSqueeze locks up all together, with jlayer it
just stops on its own (though still reporting as playing). It seems to
happen more often with bigger playlists, but that may just be
anecdotal.

WIth the plugin a restart is required, with jlayer pressing play or
next gets it going again. Its frustrating as I am just using
SoftSqueeze as a remote control, ideally I'd like to take the audio
portion of the data and just trash it.

This is with SS 2.2 on Linux Fedora Core 3, Java 1.5.0_01-b08.

Thanks,

-Chris

rtitmuss
2006-02-04, 05:56
Chris Laplante wrote:

>Did this memory leak ever get resolved?
>
>
AFAIK Softsqueeze has never had any memory leaks, the issues discussed
earlier in this thread were to do with deadlocks.

>I seem to be having a similar problem:
>
>Exception in thread "AudioDecoder-1" java.lang.OutOfMemoryError: Java heap space
>
>I already had my Max Heap size set to 128M, I have upped it to 256 to
>see if the situation changes any.
>
>With the mp3plugin SoftSqueeze locks up all together, with jlayer it
>just stops on its own (though still reporting as playing). It seems to
>happen more often with bigger playlists, but that may just be
>anecdotal.
>
>
Do you find this is an issue the certain tracks? I wonder in the mp3
decoders are having problems with something in the bitstream?

>WIth the plugin a restart is required, with jlayer pressing play or
>next gets it going again. Its frustrating as I am just using
>SoftSqueeze as a remote control, ideally I'd like to take the audio
>portion of the data and just trash it.
>
>
You could try the ShadowPlay plugin.