Changes between Version 4 and Version 5 of PJNATH_Memory_Usage


Ignore:
Timestamp:
Jun 5, 2010 8:43:34 AM (9 years ago)
Author:
bennylp
Comment:

Added RTCP disabling optimization

Legend:

Unmodified
Added
Removed
Modified
  • PJNATH_Memory_Usage

    v4 v5  
    55}}} 
    66 
    7 = PJNATH Heap Usage Analysis and Optimization = 
     7= PJNATH/ICE Heap Usage Analysis and Optimization = 
    88 
    99'''Table of Contents''' 
     
    205205[[BR]] 
    206206 
    207 == Optimized Results == 
     207== More Optimized Results == 
    208208 
    209209The result, after using the {{{config_site.h}}} settings above: 
     
    219219[[BR]] 
    220220 
     221 
     222[[BR]] 
     223 
     224== Wait, There's More! == 
     225 
     226If memory constraint is really really tight, there is one more final optimization that we can do, i.e. '''disabling RTCP''', by declaring this macro in {{{config_site.h}}}: 
     227 
     228 {{{ 
     229#define PJMEDIA_ADVERTISE_RTCP                  0 
     230 }}} 
     231 
     232Since many ICE objects are duplicated across ICE components (RTCP is an ICE component), this could potentially lower the heap usage by half! 
     233 
     234While the library currently only provides RTCP for media statistics to assist troubleshooting, still it's quite useful sometimes. You will loose RTT and TX statistics if you disable RTCP (for TX stats, you could get it in the remote endpoint of course). The system designer would need to decide whether this is a feasible optimization. 
     235 
     236== Final Result == 
     237 
     238With RTCP '''turned off''', here are the final result: 
     239 
     240|| ||   Used || Allocated ||    Utilization% || 
     241||1) App initialization, after TURN allocation  ||11,264        ||13,184        ||85|| 
     242||2) After pjsua_start()        ||14,216        ||16,768        ||85|| 
     243||3) Idle after initialization  ||8,304 ||9,600 ||87|| 
     244||4) Right after making outgoing call   ||12,800        ||14,464        ||88|| 
     245||5) After ICE negotiation is complete  ||18,544        ||20,992        ||88|| 
     246||6) 1 minute into call ||13,136        ||14,720        ||89|| 
     247 
     248It does reduce the heap consumption by close to half in some checkpoints (e.g. when idling after initialization), and significantly reduce the usages on other checkpoints. 
     249 
     250 
    221251== Conclusion == 
    222252 
    223 After the optimization, peak memory usage is around 29KB per call, compared to 75KB previously. I think that's not bad! But please continue reading the warnings below. ;-) 
     253We've shown that with the default settings, the '''peak''' heap usage per call is around '''76 KB''', then we reduce it to around '''29 KB''', then after the final tweak, it's down to around '''21 KB''' only. I think that's not bad!  
     254 
     255But please continue reading the warnings below. 
    224256 
    225257 
     
    231263 - the number of candidates will vary on each host, hence the memory usages will vary. 
    232264 - these are just crude experimentations, just to give an idea on how to experiment further 
     265 - once again, please bear in mind that we're only optimizing PJNATH here, other settings are left to their default values. 
    233266 
    234267