This particular tip deals with performance analysis and troubleshooting. Mark Myers (London Developer Co-op) and Julian Robichaux (panagenda) focus on code optimization, troubleshooting with FindBugs, analyzing Java Memory Usage and a whole lot more. The rest of thir presentation (which you can download for free in the IBM Connect 2014 community on SocialBizUG.org) is packed full of useful information relational data access; images, PDFs, and Plugins; IDEs other than Domino Designer you may want to consider; and tons of resources.
3. Code Optimization

Make your code work first, then worry about speed
–
You always want working code to fall back on

Is it fast enough? Leave it alone.

An elegant solution that is slightly slower is often better than an ugly solution that is slightly faster

Making code shorter doesn’t make it faster

Keep the code readable and easy to troubleshoot

Don’t assume you know where the bottleneck is
“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil” - Donald Knuth
4. Static Code Analyzers

FindBugs is a great tool for finding potential problems

Bugs grouped by categories
–
Scariest
–
Scary
–
Troubling

Also subcategories like “Correctness”, “Security”, “Performance”, and “Dodgy Code”

New cloud option for development teams
–
Rank bugs, assign fixes

http://findbugs.sourceforge.net

http://www.cs.umd.edu/~pugh/MistakesThatMatter.pdf
7. Debugging, Logging, and Unit Testing

Mark and Julian did a 2-hour presentation on debugging, logging, and unit testing at Lotusphere 2012
–
Please see the slides at:
–
http://londondevelopercoop.com/ldc.nsf/pages/goodies

Highlights:
–
How to add unit testing to Java code in DDE
–
How to add unit testing to JavaScript code
–
Debugging Java agents on Notes clients and Domino servers
–
Debugging Java classes used by XPages
–
Tips for using Java logging
8. Common Bottlenecks

Some other guy’s server

Slow database queries

Memory issues
–
Leaks (less common than you’d think)
–
Too much cached information
•
Especially large objects, strings, XML
–
Strong references

Loading and unloading resources

Non-lazy initialization of objects

Slow or broken network connection
9. Simulating Poor Network Connections

http://www.charlesproxy.com

http://jagt.github.io/clumsy

Network Link Conditioner (OSX)
–
XCode > Open Developer Tool > More Developer Tools
10. Analyzing Java Memory Usage

Used for:
–
Tracking down memory leaks
–
Finding high-memory-use objects (and arrays)
–
Finding objects that are unexpectedly still in memory

IBM Heap Analyzer
–
https://www.ibm.com/developerworks/community/alphaworks/tech/heapanalyzer
–
http://www-01.ibm.com/support/docview.wss?uid=swg27006624&aid=1

YourKit Java profiling app
–
http://yourkit.com
–
http://notesin9.com/index.php/2012/11/29/notesin9-091-xpages-memory-profiling-part-1

Eclipse Memory Analysis Tool
–
http://www.eclipse.org/mat/downloads.php
–
http://lazynotesguy.net/blog/2013/08/30/wheres-my-memory-gone-peeking-inside-jvms- heap-part-1-installation
–
http://lazynotesguy.net/blog/2013/10/04/peeking-inside-jvms-heap-part-2-usage
11. Generating Heap Dumps with Notes/Domino

Domino XPages
–
tell http xsp heapdump
–
XPages Toolbox ( http://www.openntf.org/p/XPages%20Toolbox )

Notes Client (Expeditor)
–
notesframeworkrcprcplauncher.exe -com.ibm.rcp.core.logger#dump heap -dumps heapdump
–
writes to notesdataworkspacelogsheapdump.###.phd by default
–
You can also do a core (thread) dump with:
•
notesframeworkrcprcplauncher.exe -com.ibm.rcp.core.logger#dump threads -dumps javacore

Directly from Java
–
com.ibm.jvm.Dump.HeapDump();
–
writes to notesframeworkheapdump.###.phd when run from an agent
12. 
Access Connect Online to complete your session surveys using any:
–
Web or mobile browser
–
Connect Online kiosk onsite
167
Mark Myers London Developer Coop mark@energywins.co.uk Twitter: @stickfight
Julian Robichaux panagenda jrobichaux@panagenda.com Twitter: @jrobichaux