Jackd performance

Found a bug? Post it here.
Post Reply
gilzad
Posts: 92
Joined: Wed Dec 19, 2012 6:46 am

Jackd performance

Post by gilzad »

Hi Alex & all,

I've done further testing on the performance of SunVox through jackd. I haven't found a solution yet but I hope I can describe the symptoms well enough.

SunVox's performence is weaker, when it uses jackd directly as driver.

My alsa is set up to have a buffer size of 512 and 4 periods. So SunVox has 46 ms to render the sound before the next request arrives. So far everything makes sense to me.

To make a reliable test I set up my jackd (over low-level alsa and over firewire) to offer exactly the same buffering (512*4). But if I configure SunVox to use jackd now, then it will have permanent underrunds. If the song gets very complex the regular underruns will appear like time-stretching.

So I decided, I'd give SunVox even more time but even things like 2048*4 won't help here (and I ran my rt-kernel into deadlocks a couple of times).

I assumed that it might be some priority / scheduling problem. Using schedtool I gave SunVox realtime scheduling (SCHED_RR) and even tried the most evil nice-value (-15) but absolutely nothing changed performance wise. Interestingly nothing got worse after I gave SunVox SCHED_BATCH and made it super-nice. Anyway, it seems like it's always loosing a fight against some other process. The only other diva-process on my machine is jackd itself. It's running with SCHED_FIFO and a high prio at a normal nice-value (0).

Of course in SunVox all other audio-parameters except of the driver were set to 'Auto' during my tests.

To make sure that these issues are not related to any missing account-priviledges (pam, audio-group, etc.) I also repeated the test running SunVox and jackd as root and I got the same results.

The mentioned underruns only occour in very complex projects (cpu-wise). So to reproduce, you might need to add a bunch of reverbs...I just did that (download attachment).

Can anyone else confirm or prove wrong that SunVox runs less performant through jack than through alsa?

Sorry if I missed out something. Let me know if I can clear up anything.
Attachments
doina_stresstest.sunvox.zip
(3.39 KiB) Downloaded 395 times
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Jackd performance

Post by NightRadio »

Hi Gilzad!

I tested your project. And yes, i got some stuttering when using JACK.
But this project is really huge - it shows me 80% cpu load sometimes. How about small projects?
I'm not sure exactly, but in my mind, JACK output is slightly slower than pure ALSA. Because the JACK has additional sound routing and true 32bit processing (SunVox uses ALSA in 16bit mode).
gilzad
Posts: 92
Joined: Wed Dec 19, 2012 6:46 am

Re: Jackd performance

Post by gilzad »

Hi Alex,

did you only get some stuttering on your machine when using JACK?
I ran it on a Sandy i7 quadcore (cpu-governor at performance) and SunVox runs much slower, when using JACK.
Really, a buffer size of 2048 with 4 periods still does not help, while on ALSA 512*4 were enough.

Of course a simple project would run fine through JACK. I intentionally made a huge project for the stress-test. You can see the Reverb DSPs aren't attached to the output, they're only there to consume CPU time. Exactly this complexity works well with ALSA (512*4) but doesn't work with JACK (even with 2048*4).
I'm not sure exactly, but in my mind, JACK output is slightly slower than pure ALSA. Because the JACK has additional sound routing and true 32bit processing (SunVox uses ALSA in 16bit mode).
32bit vs. 16bit might be a reason but I don't think the additional routing is the reason.
Because even if I run

Code: Select all

SunVox->ALSA->snd_aloop->JACK->driver
...it runs much better than..

Code: Select all

SunVox->JACK->driver
So the additional routing is always there. Even more so when routing through ALSA. 'driver' in my case is either the ffado-driver or the low-lewel ALSA-driver. I have tested both.
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Jackd performance

Post by NightRadio »

...it runs much better than SunVox->JACK->driver
Hm... It is interesting...
I will try to make some tests on my machine as soon as possible.
Thank you for this info!
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Jackd performance

Post by NightRadio »

Gilzad,
one more question. What is your jackd sampling frequency? Is it differs from default SunVox 44100?
gilzad
Posts: 92
Joined: Wed Dec 19, 2012 6:46 am

Re: Jackd performance

Post by gilzad »

Hi Alex,

I think I had switched it down to 44.1 khz for the tests. I'll make sure and repeat the test this evening.

Thanks for your attention on this.
gilzad
Posts: 92
Joined: Wed Dec 19, 2012 6:46 am

Re: Jackd performance

Post by gilzad »

Hi again,

I've repeated my test. To avoid any missing account-priviledges (pam, audio-group, etc.), I did all the tests as root.

SunVox over ALSA with the following parameters (in the preferences it shows 512; 11ms):

Code: Select all

ALSA HW Default rate: 44100
ALSA HW Rate: 44100 frames
ALSA HW Buffer size: 1881 frames
ALSA HW Period size: 940
ALSA HW Periods: 0
ALSA SW Avail min: 940
ALSA SW Start threshold: 1
ALSA SW Stop threshold: 1881
The stresstest has been played fine. Even with the CPU-governor set to 'on-demand'.

SunVox over jackd with the following parameters (in the preferences it shows 8192; 185ms):

Code: Select all

jackd -d alsa -r 44100 -n4 -p 2048
[...]
Audio buffer size: 2048 frames
Permanent underruns playing the stresstest. Even with the CPU-governor set to 'performance'.

But I found out something new:
When running through jackd, SunVox utilizes only one CPU, loading it to 136% (I guess that's turbo boost).
When running through ALSA, SunVox utilizes all CPUs, and it even manages to work well with hyperthreading.

So maybe that's the problem?

My jackd is version 2 (1.9.8), the multiprocessor version.

To be really sure, I ran Renoise through jackd and through ALSA. Both times it was using all CPUs. **Edit: I made this to make sure that being a jackd-slave doesn't bind the app to only one CPU-core.

Let me know, if I can do anything.
gilzad
Posts: 92
Joined: Wed Dec 19, 2012 6:46 am

Re: Jackd performance

Post by gilzad »

Ok, this is embarrassing.

Usually I'd always build the latest jackd version on my pc but since Debian Squeeze came with that nice package 'jackd2-firewire', I got lazy and just took it from the repo.

Now that I switched to Wheezy, jackd2 was updated, too (1.9.9). Now I understand why you had only some underruns and not so many. SunVox runs quite reliable and fast over jackd now. If there are any jackd-related flaws at all, they are so little that I wouldn't report them.

I don't know why I observed the things the use of only one CPU. It's all gone now. Most of all I don't know how to apologize for this stupid report.

Deeply sorry for the headache I caused. I'll be more careful next time. :fool:
User avatar
NightRadio
Site Admin
Posts: 3944
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Jackd performance

Post by NightRadio »

No problem :)
I don't think it's not worth my attention. If there are some issues with some jackd versions - i must check it whenever possible :)
Anyway, it is a good news that SunVox works fine with your jackd now.
Thanks!
Post Reply