[asterisk-dev] [RFC] optimisinf RTP traffic? (Roy Sigurd Karlsbakk)

Roy Sigurd Karlsbakk roy at karlsbakk.net
Thu Jul 20 08:21:22 MST 2006


> > once again, I'm trying to find a good way to speed up RTP bridging.
> > in real-world environments where more than 50% of the clients are
> > behind NAT, one cannot just use reinvites because of NAT problems,
> > audio disappears etc. so, since NAT implies the need for bridging  
> RTP
> > somehow. The current implementation with the good-old recvfrom/ 
> sendto
> > is inefficient. the use of these calls makes a overwhelming overhead
> > in kernel-space due to context-switching between user and kernel.  
> I'm
> > just thinking using sendfile or something like it would be useful,
> > since there's hardly anything like a mmap for udp.
>
> I do not know what sendfile can do, but just keep me in the loop on  
> your
> effort as I am also looking into optimizting RTP performance in  
> asterisk.

ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);

sendfile() can do zero copy transmission of data between sockets,  
meaning no in-memory copying of the data, and having the NIC (if  
supported) generate checksums as well. This will increase the number  
of bridgable calls by, well, although I obviously haven't tested it,  
quite a lot.
but then, since sendfile() just sends the data, this means you won't  
be able to Monitor() the calls, you won't be able to touch the RTP  
stream. someone said 'you need to update RTP timestamps', but I  
disagree, since dejittering is done in the endpoint, and then it's  
the client's timestamps that are important. My setup is client -  
asterisk - asterisk - pstn, and it's the pstn gateway dejittering  
(using 1.2.9.1 with the jb patch from asterisk-backports.org).

>  I've got some code that shaves off a few CPU cycles in RTP  
> bridging in user
> space but you are right - the breakthrough in RTP brigding should  
> in done on
> the kernel. Please don't hesitate to contact me if you need someone  
> who can
> code and test a few things.

I beleive sendfile() can do this quite a bit better, but since I do  
not know the RTP code too well, I have no idea of where to start.

thanks

roy

>
> Thanks
>
> -c
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev

--
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