Re: [LAD] Pipes vs. Message Queues

From: Clemens Ladisch <clemens@email-addr-hidden>
Date: Fri Nov 25 2011 - 14:33:00 EET

Nick Copeland wrote:
> > I got curious, so I bashed out a quick program to benchmark pipes vs
> > POSIX message queues. It just pumps a bunch of messages through the
> > pipe/queue in a tight loop.

This benchmark measures data transfer bandwidth. If increasing that
were your goal, you should use some zero-copy mechanism such as shared
memory or (vm)splice.

> You might be running into some basic scheduler weirdness here though
> and not something inherently wrong with the POSIX queues.

The difference between pipes and message queues is that the latter are
typically used for synchronization, so it's possible that the kernel
tries to optimize for this by doing some scheduling for the receiving
process.

> The results with 1M messages had wild variance with SCHED_FIFO,

SCHED_FIFO is designed for latency, not for throughput. It's no
surprise that it doesn't work well when you have two threads that both
want to grab 100 % of the CPU.

> > The first result really has me thinking how much Jack would benefit from
> > using message queues instead of pipes and sockets.

My guess: not at all, because Jack's payload isn't big enough to matter.

Regards,
Clemens
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Fri Nov 25 16:15:02 2011

This archive was generated by hypermail 2.1.8 : Fri Nov 25 2011 - 16:15:03 EET