This is very common question asked by many.
Enterprise systems are made up of 4 components.
Primary Memory: Make sure that we use memory efficiently. Reduce the foot print.
CPU: Use CPU friendly algorithms for calculations. Example: One team member is fetching records and counting them in while loop to know total number of records. Instead of this he should have use select count(*)
Use Visual VM to monitor CPU, Memory. Use JMeter or other tools to simulate load.
1. Take memory dump and analyze total number of objects and its size
2. Avoid object creation. Reuse Objects. Example: String query = a+b+c+d+ ….etc
3. Do proper code review and check SONAR violations
4. Use New Relic, Spring Insight, Visual VM, JMeter, …tools
5. JMon API is good one to check performance
6. Establish bench mark performance numbers.
Secondary Memory: File System/Database comes under this. Reduce total number of trips. Store wisely.
1. Reading same object again and again is not good. Better to cache them. Implement good caching algorithms.
2. Instead of statement, prepared statements are good
3. Avoid select *. If user needs two columns, it is better to choose only those two, instead of using select * and using data only from two columns.
4. Where clause order
5. Indexes, Re-indexes, Table Partitions, …etc
6. Instead of making two calls to database, combine them and fetch data in one call
Network: Network latency, Network Bandwidth, HTTP Connection reuse, Time Outs, Firewalls, ..etc
>ping -t http://www.google.com
Pinging http://www.google.com [18.104.22.168] with 32 bytes of data:
Request timed out.
Request timed out.
Ping statistics for 22.214.171.124:
Packets: Sent = 2, Received = 0, Lost = 2 (100% loss),
Operating System / JVM Performance Tuning: Check Memory Settings, JVM Parameters, …etc
Java Performance and Scalability: A Quantitative Approach Paperback
by Henry H. Liu
Oracle Database 12c Performance Tuning Recipes: A Problem-Solution Approach [Paperback]
Sam Alapati (Author), Darl Kuhn (Author), Bill Padfield (Author)
Introduction to Algorithms [Hardcover]
Thomas H. Cormen (Author), Charles E. Leiserson (Author), Ronald L. Rivest (Author), Clifford Stein (Author)
The Definitive Guide to Terracotta: Cluster the JVM for Spring, Hibernate and POJO Scalability (Expert’s Voice in Open Source) [Paperback]
Terracotta Inc. (Author)
Instant Effective Caching with Ehcache Paperback
by Daniel Wind (Author)
Software Performance and Scalability: A Quantitative Approach [Hardcover]
Henry H. Liu (Author)
Patterns for Performance and Operability: Building and Testing Enterprise Software [Hardcover]
Chris Ford (Author), Ido Gileadi (Author), Sanjiv Purba (Author), Mike Moerman (Author)