Lu Fang, University of California, Irvine Liang Dou, East China Normal University Harry Xu, University of California, Irvine 2015-07-09
Inefficient code regions [G. Jin et al. PLDI 2012]
Inefficient code regions [G. Jin et al. PLDI 2012]
Inefficient code regions [G. Jin et al. PLDI 2012]
Inefficient code regions [G. Jin et al. PLDI 2012] Widely exist ◦ Firefox developers fix 50+/month over 10 years
Inefficient code regions [G. Jin et al. PLDI 2012] Widely exist ◦ Firefox developers fix 50+/month over 10 years Consequences ◦ Financial loss, scalability reduction, etc.
Existing solutions ◦ Most are postmortem debugging techniques
Existing solutions ◦ Most are postmortem debugging techniques
Existing solutions ◦ Most are postmortem debugging techniques
Existing solutions ◦ Most are postmortem debugging techniques Large workloads ◦ To manifest performance problems ◦ NO NOT available in testing environment, usually
Find and fix performance problems ◦ In the testing environment ◦ Even without large workloads
Find and fix performance problems ◦ In the testing environment ◦ Even without large workloads Focus on me memo mory ry rel related ated performance problems ◦ Such as memory leaks, inefficiently used containers, etc.
Find and fix performance problems ◦ In the testing environment ◦ Even without large workloads Focus on me memo mory ry rel related ated performance problems ◦ Such as memory leaks, inefficiently used containers, etc. ◦ Also many y red edundant ndant co compu puta tations tions Such as unnecessary function calls
A novel performance testing framework ◦ To detect memory related performance problems
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems De Desc scribe the ribe the sympt symptoms oms an and d co counte unter r ex examples amples
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems
e.g. g. to to dete tect ct memo me mory leaks, ks, o is not o not used used for a fo a l lon ong ti g time me A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems o is used o used aga gain, n, so o o is not o not le leaki king ng
A novel performance testing framework ◦ To detect memory related performance problems General idea: amplify performance problems
Virtual amplification ◦ Provide test oracles ISL (Instrumentation Specification Language) ◦ Describe memory related performance problems Mirror chain ◦ Record useful debugging information
Amplification (at object level) ◦ Add space penalties to suspicious objects ◦ Make the symptoms more obvious ◦ Deamplification
Amplification (at object level) ◦ Add space penalties to suspicious objects ◦ Make the symptoms more obvious ◦ Deamplification Virtual ◦ Counter per object
Amplification (at object level) ◦ Add space penalties to suspicious objects ◦ Make the symptoms more obvious ◦ Deamplification Virtual ◦ Counter per object Virtual Space Overhead (VSO) ◦ (P+S)/S P is the sum of counters of all the tracked objects S is the size of the live heap ◦ Test oracle indicator of performance problems
Describe performance problems manifested by memory inefficiencies ◦ such as memory leaks, etc.
Describe performance problems manifested by memory inefficiencies ◦ such as memory leaks, etc. A simple, event-based language ◦ Describe symptoms/counterexamples ◦ Specify the corresponding actions
Describe performance problems manifested by memory inefficiencies ◦ such as memory leaks, etc. A simple, event-based language ◦ Describe symptoms/counterexamples ◦ Specify the corresponding actions An ISL program consists of: ◦ TObject ◦ Context ◦ History ◦ Partition ◦ Event
• TO TObject ect Tr Track acked ed Ob Objects ects • Conte ntext xt
• TO TObject ect Tr Track acked ed Ob Objects ects • Conte ntext xt Hi Hist story ory • Hi Hist story ory In Info formation mation • Pa Parti titio tion
• TO TObject ect Tr Track acked ed Ob Objects ects • Conte ntext xt Hi Hist story ory • Hi Hist story ory In Info formation mation • Pa Parti titio tion Sy Symp mptoms toms and nd • Event vent Counter unterexa examples mples
Memory leaks in Java programs ◦ Use seles ess objects cannot be reclaimed because of unnece necess ssary ary references Memory leak symptoms in Java programs ◦ Leaking objects are neither read nor written any more (st stale) The counterexamples of memory leaks ◦ The object is accessed again
Sp Specify cify the e tra rack cked ed obje jects cts Context TrackingContext { Context : (1) Calling Context sequence = "*,*.main,*"; (2) Object Type TObject : Tracked Object type = "java.lang.Object"; Specification } TObject MyObj{ include = TrackingContext; Event on_rw(Object o, Field f, partition = P; Word w1, Word w2){ instance boolean useFlag = o.useFlag = true; false; //Instance Field deamplify(o); } } History UseHistory { Event on_reachedOnce(Object o){ type = "boolean"; UseHistory h = getHistory(o); size = 10;//User Parameter h.update(o.useFlag); } if(h.isFull() Partition P { && !h.contains(true)){ kind = all; amplify(o); history = UseHistory; } } }
Record cord his istory tory information formation Context TrackingContext { History : Execution Windows sequence = "*,*.main,*"; Partition: (1) Heap Partitioning type = "java.lang.Object"; (2) The Binding History } TObject MyObj{ include = TrackingContext; Event on_rw(Object o, Field f, partition = P; Word w1, Word w2){ instance boolean useFlag = o.useFlag = true; false; //Instance Field deamplify(o); } } History UseHistory { Event on_reachedOnce(Object o){ type = "boolean"; UseHistory h = getHistory(o); size = 10;//User Parameter h.update(o.useFlag); } if(h.isFull() Partition P { && !h.contains(true)){ kind = all; amplify(o); history = UseHistory; } } }
Define De fine the e action tions Context TrackingContext { Event: (1) Counterexamples sequence = "*,*.main,*"; (2) Symptoms type = "java.lang.Object"; } TObject MyObj{ include = TrackingContext; Event on_rw(Object o, Field f, partition = P; Word w1, Word w2){ instance boolean useFlag = o.useFlag = true; false; //Instance Field deamplify(o); } } History UseHistory { Event on_reachedOnce(Object o){ type = "boolean"; UseHistory h = getHistory(o); size = 10;//User Parameter h.update(o.useFlag); } if(h.isFull() Partition P { && !h.contains(true)){ kind = all; amplify(o); history = UseHistory; } } }
Very useful for debugging [G. Xu et al, PLDI 2011] ◦ Reveal both calling context and data structures
Very useful for debugging [G. Xu et al, PLDI 2011] ◦ Reveal both calling context and data structures Difficult to obtain Backward information of object graph is not available In practice, GC implementations use BFS
◦ A mirror of reference path Wha hat t we we wa want nt Wha hat t we we ge get
◦ A mirror of reference path Wha hat t we we wa want nt Wha hat t we we ge get ◦ An algorithm to build the mirror chain Details can be found in our paper
We have implemented 3 amplifiers ◦ Memory leak amplifier ◦ Under-utilized container (UUC) amplifier ◦ Over-populated container (OPC) amplifier Benchmarks ◦ DaCapo benchmark suite [S. Balckburn, et al. OOPSLA 2006] Totally we have found 11 performance problems ◦ 8 unknown problems ◦ 3 known problems
60 VSOs caused by confirmed memory leaks Basic VSOs 50 40 30 20 VSO is large The program is very like to have leaks 10 0 antlr bloat eclipse fop luindex lusearch pmd hsqldb jython xalan Programs with confirmed unknown leaks
60 VSOs caused by confirmed under-utilized containers Basic VSOs 50 40 30 20 VSO is large The program is very likely to have UUCs 10 0 antlr bloat eclipse fop luindex lusearch pmd hsqldb jython xalan Programs with confirmed unknown UUCs
30 VSOs caused by confirmed over-populated containers Basic VSOs 25 20 15 VSO is large The program is very like to have OPCs 10 5 0 antlr bloat eclipse fop luindex lusearch pmd xalan hsqldb jython Programs with confirmed unknown OPCs
Recommend
More recommend