Java Performance Tuning
Java(TM) - see bottom of page
Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Concurrency, Threading, GC, Advanced Java and more ...
Tips July 2010
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 116 contents
http://www.ibm.com/developerworks/java/library/j-5things7.html
5 things you didn't know about ... Java performance monitoring, Part 1 (Page last updated June 2010, Added 2010-07-27, Author Ted Neward, Publisher IBM). Tips:
- JConsole is a built-in Java performance profiler that works from the command-line and in a GUI shell. It's not perfect, but it's an adequate first line of defense
- The most effective response to a performance problem is to use a profiler rather than reviewing the code or JVM garbage collector flags.
- Monitor the class count - if the count steadily rises, then you can assume that either the app server or your code has a ClassLoader leak somewhere and will run out of PermGen space before long.
- com.sun.management.HotSpotDiagnostic has a "dumpHeap" mebean operation that allows a dump to be created (remotely) which can be analysed later.
http://www.ibm.com/developerworks/java/library/j-5things8.html
5 things you didn't know about ... Java performance monitoring, Part 2 (Page last updated July 2010, Added 2010-07-27, Author Ted Neward, Publisher IBM). Tips:
- jstat can monitor garbage collection and JIT compiler statistics
- jstack will get a stack dump from any process
- jmap can produce a dump of the heap, or a histogram of live classes and how many instances there are and the spaced used by them.
- jhat supports analysing heap dumps obtained from jmap or jconsole or HotSpotDiagnostic.dumpHeap
http://marxsoftware.blogspot.com/2010/07/sleek-enummap-and-enumset.html
The Sleek EnumMap and EnumSet (Page last updated July 2010, Added 2010-07-27, Author Dustin Marx, Publisher marxsoftware). Tips:
- Use EnumMap and EnumSet for Enums rather than other Maps or Sets, as these are specialized efficient implementations for Enums (for both space and time)
http://www.javacodegeeks.com/2010/07/java-best-practices-dateformat-in.html
DateFormat in a Multithreading Environment (Page last updated July 2010, Added 2010-07-27, Author Justin Cater, Publisher javacodegeeks). Tips:
- Either synchronize all accesses to DateFormat instances (if there are no thread pools using these); or use DateFormat instances in ThreadLocals in thread pools.
- Alternatives to (the non-thread-safe) DateFormat include org.apache.commons FastDateFormat and JodaTime and custom thread-safe implementations [some referenced from article comments].
http://www.royans.net/arch/thoughts-on-scalable-web-operations
Thoughts on scalable web operations (Page last updated June 2010, Added 2010-07-27, Author Royans Tharakan, Publisher royans). Tips:
- When planning for scalability, plan for up to 10 times the current load - beyond that is probably pointless (as the solution probably needs to change beyond that)
- An RDBMS is fine until you really need something which can?t fit on 2 or 3 servers.
- Optimize performance on single node before you optimize and re-architect a solution for horizontal scalability.
- Use (encrypted+signed if required) cookies to store data wherever possible
- When you find yourself doing something more than 2 times, write scripts to automate it.
- When users report failures before monitoring systems do, write better monitoring tools.
- Provide audit trails to help understand what has happened.
- For networking, think in packets and not bytes to save load time.
- Embed short CSS files in HTML (rather than compressthem).
- Know your systems baselines.
http://highscalability.com/blog/2010/7/12/creating-scalable-digital-libraries.html
Creating Scalable Digital Libraries (Page last updated July 2010, Added 2010-07-27, Author Tavis Hampton, Publisher highscalability). Tips:
- Rather than hosting every single image, video, text document, pdf, etc. on the web application server, CDNs (Content Delivery Networks) host the static content on multiple redundant servers, spread across numerous geographic locations. When a user accesses a particular collection piece, the CDN will locate the server closest to the user, with the fewest hops to get the the user, and deliver the content.
- For non-textual data 80 to 90% of the user response time will come from downloading the images, video, etc.
- On a large scale site with millions of users, searches need to be routed to specific nodes that use optimized search capability.
- Cache the results of common searches rather than re-execute them.
- Test your website under heavy loads, monitor the statistics, find the bottlenecks, fix, and retest until you are satisfied.
- Do not ignore background processes that may actually be slowing down your site.
- Scaling early is a cost vs. potential benefit tradeoff that means you may want to degrade services rather than take the up-front cost. But you should consider the tradeoffs.
Jack Shirazi
Back to newsletter 116 contents
Last Updated: 2024-12-27
Copyright © 2000-2024 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/newtips116.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us