Re: [LAU] IO scheduler for realtime audio?

From: Robin Gareus <robin@email-addr-hidden>
Date: Sun Jan 09 2011 - 17:38:55 EET

On 01/09/2011 12:33 AM, Jaromír Mikeš wrote:
> Hi all,
>
> let's assume I have ssd disk, ext4 file system and latest RT kernel
> 2.6.33.7.2-30rt
> What is the best choice for IO scheduler for realtime audio?

short answer:

As for SSD disks with ext4 I don't know. I've not yet analyzed this
combination, but my gut-feeling is to use the deadline scheduler

Some details that may or may not come in handy:

"best for audio" could mean:
 - max thoughput : record/play lots of tracks simultaneously
 - low latency: lots of random seeks, many small files.
 - low CPU usage of the scheduler: mostly negligible but can become
important with large fifo_queue for the deadline sched.

They're contradicting each other.

'noop' and 'deadline' yield better performance for SSDs; but noop is not
really suitable if you want to do concurrent/multi-threaded disk access
(noop will block when accessing large files).

With the deadline scheduler you should also increase the number of seeks
(they're cheap on SSDs) and thereby reduce latency with
  echo 1 > /sys/block/DEVICE/queue/iosched/fifo_batch
(a higher value will reduce seeks but also increases latency.)

You may want to run some tests. a simple read-test:
  `hdparm -t DEVICE`
Timing a kernel compilation is another good test.

Query and change the scheduler on the fly:
  cat /sys/block/DEVICE/queue/scheduler
  echo SCHEDULER > /sys/block/DEVICE/queue/scheduler
where DEVICE is e.g. 'sda' and SCHEDULER is one of
 'noop' 'anticipatory' 'deadline' 'cfq' 'bfq'

and you can make the change permanent by
 a) recompiling the kernel
or
 b) use 'elevator=SCHEDULER' boot-flag
or
 c) set it via /etc/sysctl.conf

There's a few more things you can tweak in
  /sys/block/DEVICE/queue/iosched/
but those depends on the scheduler.

http://wiki.linuxquestions.org/wiki/IOSched has an overview of the I/O
schedulers (excl. bfq) and lists the important tweakable parameters.
/usr/src/linux/Documentation/block has the details.

A general good advice is to mount SSDs with the
'noatime' mount-option to reduce writes to the device and prolong the
lifetime. For ext4 also use the 'discard' option which enables TRIM:
http://en.wikipedia.org/wiki/TRIM

There's even more tweaks: for instance you can disable write-back caching:
  hdparm -W0 DEVICE
It's usually enabled by default, but the architecture of an SSD often
results in poorer performance with it.

Most of this info comes from a brainstom session (collected from various
sites and mailing-lists) in order to make a dedicated .deb package which
automatically does this changes for 64studio, but things are moving slowly.

Also note that ext4 and SSD-block drivers have been updated and improved
since 2.6.33. You may see some improvement with newer kernels.

ciao,
robin

> thanks for advice
>
> mira
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user@email-addr-hidden
> http://lists.linuxaudio.org/listinfo/linux-audio-user

-- 
Robin Gareus
web: http://gareus.org/                mail: robin@email-addr-hidden
lab: http://citu.fr/                   chat: xmpp:rgareus@email-addr-hidden
Public Key at http://pgp.mit.edu/  http://gareus.org/public.asc
Fingerprint : 7107 840B 4DC9 C948 076D 6359 7955 24F1 4F95 2B42
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sun Jan 9 20:15:01 2011

This archive was generated by hypermail 2.1.8 : Sun Jan 09 2011 - 20:15:02 EET