Re: [RTnet-developers] Maintaining UDP sockets in a hash instead of a list.
Brought to you by:
bet-frogger,
kiszka
|
From: Gilles C. <gil...@xe...> - 2008-08-28 15:47:04
|
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
>> Gilles Chanteperdrix wrote:
>>> Hi,
>>>
>>> here is a repost of the rtnet-hash-port.diff patch. Only, without the
>>> "receiving" bit, and with the INADDR_ANY bit fixed.
>> OK, almost ready for merge.
>>
>> BTW, did you also happen to measure the performance gain (and for how
>> many sockets)?
>
> I have just done a quick test: with 200 sockets, the worst case (i.e.
> the last socket) takes 30us to search the sockets table. Due to the
> linear search, the average case is half the worst case.
>
> 200 sockets is what happens when 50 phones trying to phone outside at
> the same time, each conversation results in 4 sockets being opened by
> the NAT helper for each conversation (1 RTP outbound, 1 RTCP inbound, 1
> RTP inbound, 1 RTP). An RTP stream takes 50 packets by second. an RTCP
> stream 0.2 packet by second. So, the total is 100 * 50 + 100 * 0.2 =
> 5020 packets by second, and the overhead of the socket search is 5020 *
> 15 us = 75300 us, i.e. 75 ms, i.e. 7.5 % CPU.
>
> Now, when using the hash table, the worst case, which is the same as the
> average case is 2 us, that is precisely 7.5 times less, so the overhead
> is 1%.
>
> Needless to say, that on a machine where just searching a socket in a
> hash table consumes 1% of the CPU, we simply can not run 50 external
> phone calls at the same time.
Actually, the box sustains 5000 packets by second. Ok. They eat 80% cpu.
--
Gilles.
|