SlideShare a Scribd company logo
1 of 3
Lets explore some of the tricks to monitor and improve performance of apps running
in Eclipse and also how we can write better API.

1. VisualVM is a great tool to monitor the performance of any eclipse
application. Once the plugin is installed, any eclipse app can be launched in the
VisualVM Runtime instead of a Java Runtime so that the health of the app can be
monitored in real-time.
Reference : https://visualvm.dev.java.net/eclipse-launcher.html

2. If we enable "Show Heap Status" under 'General Preferences', we can
periodically enforce GC, which is very important for heap analysis.

3. Now we can really enable in-depth monitoring by turning on Runtime
Spy through an .options file e.g. eclipse -debug c:spy.options
Here is the Update site for core tools
platform-core - http://eclipse.org/eclipse/platform-core/updates

References :
http://www.jdg2e.com/ch32.performance/doc/index.html#refs
Google Book
http://www.eclipse.org/eclipse/platform-core/downloads/tools/readme.html

Sample settings of the Runtime Spy .options file
#### Monitoring settings
# monitor class loading
org.eclipse.osgi/monitor/classes=true
# monitor bundle activation
org.eclipse.osgi/monitor/activation=true
# monitor resource bundle (*.properties) loading
org.eclipse.osgi/monitor/resources=true
#### Trace settings
# trace class loading - snapshot the execution stack when a class is loaded
org.eclipse.osgi/trace/classLoading=true
# trace location - file in which execution traces are written
org.eclipse.osgi/trace/filename=runtime.traces
# trace filters - Java properties file defining which classes should
# be traced (if trace/classLoading is true)
etc........

4. Well even after enabling all types of monitoring, we still sometimes can not find
out why certain apps leads to OutOfMemory Error !
Then the only way out is to generate the Heap Dumps and Thread Dumps.
We can add this vmarg in eclipse.ini -
-Xdump:java+heap+system:events=user,opts=CLASSIC+PHD so that whenever
SendSignal is executed corresponding dumps will be generated.
Otherwise we can start eclipse in command prompt as follows and then do
Ctrl+break to signal the vm.

eclipse -vm binjava.exe -console -consoleLog -vmargs -verbose:class -
verbose:dynload -Xms1024m -Xmx1536m -XX:MaxPermSize=128m
-Xdump:heap+java:events=user,opts=CLASSIC+PHD -Xgcpolicy:optavgpaus.

Another way to send stop signal to vm - cdb -p -c ".dump /ma java.dmp;q"
- Where is the integer process Id of the java process.

5. Time to highlight the importance of designing API and SPI using eclipse
codebase.
    This is an invaluable source of knowledge about evolving Eclipse API and
proper usage of annotations like
    @noimplement, @noextend etc.
Its a classic : http://www.eclipse.org/eclipse/development/java-api-evolution.html

6. In order to enforce API Analysis we should refer to - http://www.eclipse-
tips.com/tutorials/26-api-tooling-tutorial. After all Eclipse is meant for coding clean
interfaces and abstract classes that communicates to users through simple annotations
and robust patterns.

7. Its not a bad idea to enforce internationalization – using the setting
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error in
.settings file.

Fixing Int issues at the early stage prevents from wasting a good amount of
time and introducing unsolicited bugs at the time of product delivery phase.

8. we should flag 'unused imports' as errors in preference to make it a daily
habit getting rid of unnecessary evils.

9. Templating try / catch to actually catch and log an exception is a
MUST ! Eclipse should fix this by default providing a
exception.printStackTrace() statement. Empty catch blocks are silent killers
that remain hidden inside deeply nested api !

10. The last but not the least FindBug should be part of development
environment and be actively used.

Well ... a bonus tip for hackers :-) ... don't forget the decompiler plugin
-http://java.decompiler.free.fr/jd-eclipse/update- using
which you can even debug any class that essentially do not have source base
shipped with its tool !

11. Remote Debugging Options :
-vmargs
-Xdebug
-Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000

12. Start Eclipse in Command Prompt and see how classes are loaded


13. How to generate compiler warnings for Internationalization Checking :

-- java settings

14. How to enforce annotations for api ?
http://www.eclipse-tips.com/tutorials/26-api-tooling-tutorial
-- enforce usage of @since, @noimplement annotations

15. How to view OSGi dependency and search plugin dependency ?
STS - http://blog.springsource.com/2009/03/05/osgi-development-tools-in-sts/

http://blog.springsource.com/wp-content/uploads/2009/03/dependency-graph.png


16.Use JavaRebel Eclipse Pluging for faster hot deployment.
       http://www.zeroturnaround.com/blog/eclipse-plugin-tutorial/

17.For Server-Side application use SysDeo plugin
       http://www.eclipsetotale.com/tomcatPlugin.html

More Related Content

More from Kaniska Mandal

The Road To Openness.Odt
The Road To Openness.OdtThe Road To Openness.Odt
The Road To Openness.OdtKaniska Mandal
 
Perils Of Url Class Loader
Perils Of Url Class LoaderPerils Of Url Class Loader
Perils Of Url Class LoaderKaniska Mandal
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In EclipseKaniska Mandal
 
E4 Eclipse Super Force
E4 Eclipse Super ForceE4 Eclipse Super Force
E4 Eclipse Super ForceKaniska Mandal
 
Create a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkCreate a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkKaniska Mandal
 
Creating A Language Editor Using Dltk
Creating A Language Editor Using DltkCreating A Language Editor Using Dltk
Creating A Language Editor Using DltkKaniska Mandal
 
Advanced Hibernate Notes
Advanced Hibernate NotesAdvanced Hibernate Notes
Advanced Hibernate NotesKaniska Mandal
 
Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesKaniska Mandal
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation FrameworkKaniska Mandal
 
Protocol For Streaming Media
Protocol For Streaming MediaProtocol For Streaming Media
Protocol For Streaming MediaKaniska Mandal
 
Rest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlRest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlKaniska Mandal
 
Riding The Semantic Wave
Riding The Semantic WaveRiding The Semantic Wave
Riding The Semantic WaveKaniska Mandal
 

More from Kaniska Mandal (16)

The Road To Openness.Odt
The Road To Openness.OdtThe Road To Openness.Odt
The Road To Openness.Odt
 
Perils Of Url Class Loader
Perils Of Url Class LoaderPerils Of Url Class Loader
Perils Of Url Class Loader
 
Making Applications Work Together In Eclipse
Making Applications Work Together In EclipseMaking Applications Work Together In Eclipse
Making Applications Work Together In Eclipse
 
Eclipse Tricks
Eclipse TricksEclipse Tricks
Eclipse Tricks
 
E4 Eclipse Super Force
E4 Eclipse Super ForceE4 Eclipse Super Force
E4 Eclipse Super Force
 
Create a Customized GMF DnD Framework
Create a Customized GMF DnD FrameworkCreate a Customized GMF DnD Framework
Create a Customized GMF DnD Framework
 
Creating A Language Editor Using Dltk
Creating A Language Editor Using DltkCreating A Language Editor Using Dltk
Creating A Language Editor Using Dltk
 
Advanced Hibernate Notes
Advanced Hibernate NotesAdvanced Hibernate Notes
Advanced Hibernate Notes
 
Best Of Jdk 7
Best Of Jdk 7Best Of Jdk 7
Best Of Jdk 7
 
Converting Db Schema Into Uml Classes
Converting Db Schema Into Uml ClassesConverting Db Schema Into Uml Classes
Converting Db Schema Into Uml Classes
 
EMF Tips n Tricks
EMF Tips n TricksEMF Tips n Tricks
EMF Tips n Tricks
 
Graphical Model Transformation Framework
Graphical Model Transformation FrameworkGraphical Model Transformation Framework
Graphical Model Transformation Framework
 
Mashup Magic
Mashup MagicMashup Magic
Mashup Magic
 
Protocol For Streaming Media
Protocol For Streaming MediaProtocol For Streaming Media
Protocol For Streaming Media
 
Rest With Json Vs Soap With Xml
Rest With Json Vs Soap With XmlRest With Json Vs Soap With Xml
Rest With Json Vs Soap With Xml
 
Riding The Semantic Wave
Riding The Semantic WaveRiding The Semantic Wave
Riding The Semantic Wave
 

Eclipse Productivity Tools And Tips

  • 1. Lets explore some of the tricks to monitor and improve performance of apps running in Eclipse and also how we can write better API. 1. VisualVM is a great tool to monitor the performance of any eclipse application. Once the plugin is installed, any eclipse app can be launched in the VisualVM Runtime instead of a Java Runtime so that the health of the app can be monitored in real-time. Reference : https://visualvm.dev.java.net/eclipse-launcher.html 2. If we enable "Show Heap Status" under 'General Preferences', we can periodically enforce GC, which is very important for heap analysis. 3. Now we can really enable in-depth monitoring by turning on Runtime Spy through an .options file e.g. eclipse -debug c:spy.options Here is the Update site for core tools platform-core - http://eclipse.org/eclipse/platform-core/updates References : http://www.jdg2e.com/ch32.performance/doc/index.html#refs Google Book http://www.eclipse.org/eclipse/platform-core/downloads/tools/readme.html Sample settings of the Runtime Spy .options file #### Monitoring settings # monitor class loading org.eclipse.osgi/monitor/classes=true # monitor bundle activation org.eclipse.osgi/monitor/activation=true # monitor resource bundle (*.properties) loading org.eclipse.osgi/monitor/resources=true #### Trace settings # trace class loading - snapshot the execution stack when a class is loaded org.eclipse.osgi/trace/classLoading=true # trace location - file in which execution traces are written org.eclipse.osgi/trace/filename=runtime.traces # trace filters - Java properties file defining which classes should # be traced (if trace/classLoading is true) etc........ 4. Well even after enabling all types of monitoring, we still sometimes can not find out why certain apps leads to OutOfMemory Error ! Then the only way out is to generate the Heap Dumps and Thread Dumps. We can add this vmarg in eclipse.ini - -Xdump:java+heap+system:events=user,opts=CLASSIC+PHD so that whenever SendSignal is executed corresponding dumps will be generated.
  • 2. Otherwise we can start eclipse in command prompt as follows and then do Ctrl+break to signal the vm. eclipse -vm binjava.exe -console -consoleLog -vmargs -verbose:class - verbose:dynload -Xms1024m -Xmx1536m -XX:MaxPermSize=128m -Xdump:heap+java:events=user,opts=CLASSIC+PHD -Xgcpolicy:optavgpaus. Another way to send stop signal to vm - cdb -p -c ".dump /ma java.dmp;q" - Where is the integer process Id of the java process. 5. Time to highlight the importance of designing API and SPI using eclipse codebase. This is an invaluable source of knowledge about evolving Eclipse API and proper usage of annotations like @noimplement, @noextend etc. Its a classic : http://www.eclipse.org/eclipse/development/java-api-evolution.html 6. In order to enforce API Analysis we should refer to - http://www.eclipse- tips.com/tutorials/26-api-tooling-tutorial. After all Eclipse is meant for coding clean interfaces and abstract classes that communicates to users through simple annotations and robust patterns. 7. Its not a bad idea to enforce internationalization – using the setting -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error in .settings file. Fixing Int issues at the early stage prevents from wasting a good amount of time and introducing unsolicited bugs at the time of product delivery phase. 8. we should flag 'unused imports' as errors in preference to make it a daily habit getting rid of unnecessary evils. 9. Templating try / catch to actually catch and log an exception is a MUST ! Eclipse should fix this by default providing a exception.printStackTrace() statement. Empty catch blocks are silent killers that remain hidden inside deeply nested api ! 10. The last but not the least FindBug should be part of development environment and be actively used. Well ... a bonus tip for hackers :-) ... don't forget the decompiler plugin -http://java.decompiler.free.fr/jd-eclipse/update- using
  • 3. which you can even debug any class that essentially do not have source base shipped with its tool ! 11. Remote Debugging Options : -vmargs -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000 12. Start Eclipse in Command Prompt and see how classes are loaded 13. How to generate compiler warnings for Internationalization Checking : -- java settings 14. How to enforce annotations for api ? http://www.eclipse-tips.com/tutorials/26-api-tooling-tutorial -- enforce usage of @since, @noimplement annotations 15. How to view OSGi dependency and search plugin dependency ? STS - http://blog.springsource.com/2009/03/05/osgi-development-tools-in-sts/ http://blog.springsource.com/wp-content/uploads/2009/03/dependency-graph.png 16.Use JavaRebel Eclipse Pluging for faster hot deployment. http://www.zeroturnaround.com/blog/eclipse-plugin-tutorial/ 17.For Server-Side application use SysDeo plugin http://www.eclipsetotale.com/tomcatPlugin.html