Software Performance Anti-Patterns Observed and Resolved in Kieker - - PowerPoint PPT Presentation

software performance anti patterns observed and resolved
SMART_READER_LITE
LIVE PREVIEW

Software Performance Anti-Patterns Observed and Resolved in Kieker - - PowerPoint PPT Presentation

Software Performance Anti-Patterns Observed and Resolved in Kieker Symposium on Software Performance 2015 Christian Wulf and Wilhelm Hasselbring 06.11.2015 Software Engineering Group Kiel University, Germany Kiekers Software Architecture


slide-1
SLIDE 1

Software Performance Anti-Patterns Observed and Resolved in Kieker

Symposium on Software Performance 2015

Christian Wulf and Wilhelm Hasselbring 06.11.2015 Software Engineering Group Kiel University, Germany

slide-2
SLIDE 2

Kieker‘s Software Architecture

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 2

  • Low monitoring overhead
  • Fast Pipe-and-Filter-based analyses

(migration currently in progress)

slide-3
SLIDE 3

Software Performance Anti-Patterns

Software Performance Anti-Patterns Observed and Resolved in Kieker

  • Problem solutions which have a negative impact
  • n the performance
  • Pattern:

– name – problem description of the solution – better solution

Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 3

Excerpt of 14 anti-patterns (Smith et al. [3])

  • “god” Class
  • Unnecessary Processing
  • Excessive Dynamic Allocation
slide-4
SLIDE 4

Agenda

Software Performance Anti-Patterns Observed and Resolved in Kieker

  • Introduction
  • PAA #1: Parallelizing Sequential Dependencies
  • PAA #2: Reflection-based Record Reconstruction
  • PAA #3: Exception-based Buffer Underflow Detection
  • Conclusion

Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 4

slide-5
SLIDE 5

PAA #1: Parallelizing Sequential Dependencies

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 5

monitoring node analysis node monitoring records string registry records

thread thread thread thread

string registry string registry

Issues:

  • Two TCP connections

=> higher maintenance effort and higher security risk

  • Thread synchronization (via string registry)

=> higher communication effort

  • (Blocking) wait if a monitoring record arrives before its string registry records

=> reduced throughput Context (Kieker 1.12 and below):

slide-6
SLIDE 6

PAA #1: Parallelizing Sequential Dependencies

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 6

monitoring node analysis node monitoring records string registry records

string registry

thread

string registry

thread

Our solution: Approach:

  • First, serializes all string registry records
  • Then, serializes the record

Benefits:

  • Only one TCP connection
  • No thread synchronization required

=> Unsynchronized string registry is sufficient

  • No waits required
slide-7
SLIDE 7

PAA #2: Reflection-based Record Reconstruction

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 7

Context (Kieker 1.10 and below):

int classId = buffer.getInt(); recordClassName = stringRegistry.get(classId); record = AbstractMonitoringRecord.createFromByteBuffer( recordClassName, buffer, stringRegistry);

Major issue:

  • Reflective invocation of the record’s constructor

=> Slow, especially due to the frequent invocations1

1 http://docs.oracle.com/javase/tutorial/reflect/index.html

slide-8
SLIDE 8

PAA #2: Reflection-based Record Reconstruction

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 8

Our solution: Approach:

  • Introduction of a record factory per record type
  • Reflective search only once for each record factory

⇒ Caches subsequent accesses in a map

int classId = buffer.getInt(); recordClassName = stringRegistry.get(classId); recordFactory = cachedRecordFactoryCatalog.get(recordClassName); record = recordFactory.create(buffer, stringRegistry);

Benefits:

  • Direct invocation via Java’s keyword new

=> Fast record construction

return new ConcreteRecord(..)

slide-9
SLIDE 9

PAA #3: Exception-based Buffer Underflow Detection

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 9

Context (Kieker 1.12 and below): Issues:

  • Creation of a new exception object
  • Resolution of the current stacktrace

=> Slow and not used at all

try { // save buffer's current position reconstruct(buffer); } catch (BufferUnderflowException e) { // refill buffer // reset buffer's position }

slide-10
SLIDE 10

PAA #3: Exception-based Buffer Underflow Detection

Software Performance Anti-Patterns Observed and Resolved in Kieker Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 10

Our solution: Approach:

  • Check whether the buffer has enough bytes left for the next record
  • Return a boolean value indicating a buffer refill

// save buffer's current position boolean success = reconstruct(buffer); if (!success) { // refill buffer // reset buffer's position }

Benefits:

  • No creation of an exception
  • No stacktrace resolution

Fast buffer underflow detection

slide-11
SLIDE 11

Conclusion

Software Performance Anti-Patterns Observed and Resolved in Kieker

  • PAA #1: Parallelizing Sequential Dependencies
  • PAA #2: Reflection-based Record Reconstruction
  • PAA #3: Exception-based Buffer Underflow Detection

Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 11

Future work:

  • Avoid redundant information in before/after record
  • Avoid frequent record construction/destruction scenarios (reduce GC time)

http://kieker-monitoring.net http://teetime.sourceforge.net

slide-12
SLIDE 12

References

Software Performance Anti-Patterns Observed and Resolved in Kieker

[1] E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-

  • riented Software. Prentice Hall, 1995.

[2] A. Koenig. Patterns and antipatterns. In The Patterns Handbooks. Cambridge University Press, 1998. [3] C. U. Smith and L. G. Williams. More new software performance antipatterns: Even more ways to shoot yourself in the foot. In Proc. of the Int. CMG Conference, 2003. [4] A. van Hoorn, J. Waller, and W. Hasselbring. Kieker: A Framework for Application Performance Monitoring and Dynamic Software Analysis. In Proc. of the ICPE, 2012. [5] J. Waller, F. Fittkau, and W. Hasselbring. Application performance monitoring: Trade-off between

  • verhead reduction and maintainability. In Proc. of the Symposium on Software Performance, 2014.

[6] M. Wooldridge and N. R. Jennings. Pitfalls of Agent-oriented Development. In Proc. of the AGENTS, 1998.

Christian Wulf and Wilhelm Hasselbring ― 06.11.2015 12