Too many database queries, too much data loaded into memory, overloaded html pages, bad architectural decisions, ...
These are all reasons why Java Applications are slow. In this presentation - first given at Boston Java Meetup - shows 6 real life examples on why Java-based Applications failed - and you may even heard about this in the news.
All examples and the technical details were captured using Dynatrace which is available as a 30 Day Free Trial - http://bit.ly/dttrial - with an option to extend it for another 180 Days in case you share some of your results with us
23. Using Hibernate results in 4k+ SQL Statements to
display 3 items!
Hibernate Executes
4k+ Statements
Individual Execution
VERY FAST
But Total SUM
takes 6s
23 @Dynatrace
26. Project: Online Room Reservation System
• Symptoms
• HTML takes between 60 and 120s to render
• High GC Time
• Assumptions
• Bad GC Tuning
• Probably bad Database Performance as rendering was simple
26 @Dynatrace
27. Developers built own monitoring
void roomreservationReport(int roomid)
{
long startTime = System.currentTimeMillis();
Object data = loadDataForRoom(roomid);
long dataLoadTime = System.currentTimeMillis() - startTime;
generateReport(data, roomid);
27 @Dynatrace
}
Result:
Avg. Data Load Time: 45s!
DB Tool says:
Avg. SQL Query: <1ms!
28. #1: Loading too much data
24889! Calls to the
Database API!
High CPU and High
Memory Usage to keep all
data in Memory
28 @Dynatrace
29. #2: On individual connections 12444!
individual
connections
Classical N+1
Query Problem
Individual SQL
really <1ms
29 @Dynatrace
30. #3: Putting all data in temp Hashtable
Lots of time
spent in
Hashtable.get
Called from their
Entity Objects
30 @Dynatrace
31. Lesson Learned
• Custom Measuring
• Was impacted by Garbage Collection
• Just measured overall time but not # SQL Executions
void roomreservationReport(int roomid)
{
long startTime = System.currentTimeMillis();
Object data = loadDataForRoom(roomid);
long dataLoadTime = System.currentTimeMillis() - startTime;
generateReport(data, roomid);
}
• Learn SQL and don’t use Hashtables as Workaround
31 @Dynatrace
40. “Teamwork” between Dev and Ops
SEV1 Problem in Production
Need access to log files
Where are they? Can’t get them
Need to increase log level
Can’t do! Can’t change config
files in prod!
40 @Dynatrace
44. Root Cause: A special WebSphere Setting!
Log Service provides a
synchronized log file across
Log Service provides a synchronized
ALL JVMs
log file across ALL JVMs
44 @Dynatrace
48. Test Environment Production Environment
Hibernate,
Hibernate,
Classloading,
XML – The Key
Classloading, XML
– The Key Hotspots
I/O for Web
Requests Hotspots
doesn’t
even show up!
That’s Normal:
Having I/O for Web
Request as main
contributor
48 @Dynatrace
49. Top Contributor
Class.getInterfaces
Called from Hibernates
FieldInterceptionHelper
These calls all originate
form thousands of calls to
find item by code
49 @Dynatrace
50. Top Methods related to XML
Processing
Classloading is triggered through
CustomMonnkey and the Xalan
CustomMonkey and the Xalan
Parser
50 @Dynatrace
More detailed stories can also be found on our blog: http://blog.dynatrace.com
All examples have been found using Dynatrace Free Trial – http://bit.ly/dttrial
Just a bit about myself: That’s where I am from: Austria!
Not the country with the kangaroos!
That was my first Amiga 500 which I got when I was 9 years old!