[asterisk-dev] [RFC] optimising RTP traffic?
Roy Sigurd Karlsbakk
roy at karlsbakk.net
Thu Jul 20 19:05:38 MST 2006
> I'd like to offer my 2c on the issue: Before you look really hard
> at what it takes to try to move RTP forwarding up from the
> application and into the kernel, it would make sense to:
>
> a) Profile the present situation: You can use oprofile or other
> tools to profile the entire system, and see where most of the time
> is being spent. If the goal is to optimize this process, this
> would point out the places to look. I don't know if this has been
> done or not yet, but it seems the original idea was based on
> intuition, not on actual results.
I've done so, which was the reason I started digging into this. I
tried setting up two boxes sending SIP/RTP calls between them without
reinvites, and with a single xeon ~3GHz, 500 calls kills the system.
About 70% of the time is spent in kernel, as I can see from context
switching between kernel- and userspace. This makes Asterisk unusable
to do such bridging in large traffic amounts. I'm told, though, that
this is not a problem since this is not what asterisk's built to do.
However, I find it hard to beleive software shouldn't be allowed to
get better.
> b) Build a system that you can at least use for profiling, which
> works using sendfile() or similar, even if it doesn't actually work
> properly, and benchmark it. The point here is to just get a
> ballpark of the improvement you expect to see, to determine if it's
> worth actually making it all work. You don't need to dot the i's
> and cross the t's, just make it something you can set up calls
> with, and benchmark.
It really is not necessary to do this. Looking at the oprofile output
shows all the time is spent within readfrom/sendto and related calls
and their respective switches of contexts. Sendfile is plain and
doesn't involve such things. Doing the sendfile test will be a
complete waste of time, beleive me. sendfile() just takes two file
descriptors and connects them, without involving either userspace nor
kernel checksumming, so i'd guess something like 60%+ of the time
taken to bridge RTP will be gone.
roy
--
Roy Sigurd Karlsbakk
roy at karlsbakk.net
(+47) 98013356
---
In space, loud sounds, like explosions, are even louder because there
is no air to get in the way.
More information about the asterisk-dev
mailing list