[Live-devel] possible candidate for patch (Groupsock.cpp)

Maxim Petrov max at code-it-now.com
Fri Mar 30 01:02:40 PDT 2007


Ross Finlayson wrote:

>>I noticed strange performance troubles on server side (CPU usage was
>>more than usually) when streaming huge JPEG files. After few minutes of
>>researching I noticed that for sending each RTP packet we call
>>"outputToAllMemberExcept" function even if we don't have any member. So
>>basicaly it's useless? Here's patch:
>>
>>@@ -269,11 +269,14 @@
>>     statsGroupOutgoing.countPacket(bufferSize);
>>
>>     // Then, forward to our members:
>>-    int numMembers =
>>-      outputToAllMembersExcept(interfaceNotToFwdBackTo,
>>+    int numMembers = 0;
>>+    if (!members().IsEmpty()) {
>>+        numMembers =
>>+          outputToAllMembersExcept(interfaceNotToFwdBackTo,
>>                               ttlToSend, buffer, bufferSize,
>>                               ourSourceAddressForMulticast(env));
>>     if (numMembers < 0) break;
>>+    }
>>
>>     if (DebugLevel >= 3) {
>>       env << *this << ": wrote " << bufferSize << " bytes, ttl "
>>
>>
>>After applying this patch CPU usage normalized again. Can you please
>>comment is patch correct or no?
>>    
>>
>
>Yes, it's OK - although I'm very sceptical about it having a 
>significant effect on performance.  Your change doesn't save much 
>more than a function call.
>  
>
Well, it's really more than a function call. Look at the attached 
picture (output from valgrind). Here's details of what I streamed:
1) JPEG file size  ~ 106 kb;
2) Framerate ~30 fps
As you see from picture "Groupsock::output" was invoked 23 242 times (in 
generally it's ~10 sec of streaming). Next 3 lines are our interest. 
Because "ourSourceAddressForMulticast" invoked every time we have 7 206 
890 calls of "our_random" function. Here is performance trouble.
Are you agree?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perf_issue.jpg
Type: image/jpeg
Size: 26805 bytes
Desc: not available
Url : http://lists.live555.com/pipermail/live-devel/attachments/20070330/f6487758/attachment-0001.jpg 


More information about the live-devel mailing list