advanced performance tuning in ext gwt

27
Ext GWT Performance Tuning DARRELL MEYER, SENCHA Monday, November 29, 2010

Upload: sencha

Post on 27-May-2015

3.122 views

Category:

Technology


3 download

DESCRIPTION

Application performance is critical to a usable user interface. Learn about the tools and techniques that Ext GWT developers can use to tune client-side code. Get detailed instructions on how to use the available performance profiling tools including Speed Tracer, Firebug, and Visual Studio.

TRANSCRIPT

Page 1: Advanced Performance Tuning in Ext GWT

Ext GWTPerformance Tuning

DARRELL MEYER, SENCHA

Monday, November 29, 2010

Page 2: Advanced Performance Tuning in Ext GWT

OverviewWhat to Tune?

LoggingFirebug

SpeedTracerExample

Questions

Monday, November 29, 2010

Page 3: Advanced Performance Tuning in Ext GWT

Conference App

Monday, November 29, 2010

Page 4: Advanced Performance Tuning in Ext GWT

Ext GWT 2.2.1GWT 2.1

Java Persistence API (JPA)Google App Engine (GAE)

RequestFactoryGWT MVPDependency Injection with Gin

Download at http://dev.sencha.com/playpen/gxt/conference-app.zip

Technology Stack

Monday, November 29, 2010

Page 5: Advanced Performance Tuning in Ext GWT

Eclipse IDE for Java EE Developers (Helios 3.6.1)http://www.eclipse.org/downloads/

PluginsMaven Integration for Eclipsehttp://m2eclipse.sonatype.org/sites/m2e

Maven Integration for Eclipse WTP Integrationhttp://m2eclipse.sonatype.org/sites/m2e-extras

Google Eclipsehttp://code.google.com/eclipse/

IDE & Plugins

Monday, November 29, 2010

Page 6: Advanced Performance Tuning in Ext GWT

What To Tune?

Monday, November 29, 2010

Page 7: Advanced Performance Tuning in Ext GWT

RenderingExt GWT LayoutsSlow Java / JavaScript codeMemory consumptionHTTP RequestsData sizeServer-side performance

What to Tune?

Monday, November 29, 2010

Page 8: Advanced Performance Tuning in Ext GWT

Too many Layouts and nested LayoutsReplaces layouts with templates and HtmlContainer

Slow Layouts

Monday, November 29, 2010

Page 9: Advanced Performance Tuning in Ext GWT

Must understand what your code is doing an when it is being executedStep through your code to trace executions paths, do not assume

Slow Java / JavaScript

Monday, November 29, 2010

Page 10: Advanced Performance Tuning in Ext GWT

Must be careful of objects being kept in memoryMonitor memory usage throughout the application dev lifecycleProcess Explorer on Windows http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Memory Consumption

Monday, November 29, 2010

Page 11: Advanced Performance Tuning in Ext GWT

Too many requests = bottlenecksMany browsers only allow 2 concurrent HTTP requestsAnalyze the requests your application is makingUse GWT ClientBundle and ImageResource where ever possibleUse Firebug with Firefox and SpeedTracer

Too Many HTTP Requests

Monday, November 29, 2010

Page 12: Advanced Performance Tuning in Ext GWT

Monitor the data being transferred to and from the serverSend the smallest amount of data possibleDo not sending an entire object graph

Too Much Data

Monday, November 29, 2010

Page 13: Advanced Performance Tuning in Ext GWT

Logging

Monday, November 29, 2010

Page 14: Advanced Performance Tuning in Ext GWT

LoggingEmulates java.util.loggingShare server and client code

Many logging handlersSystemLogHandlerDevelopmentModeLogHandlerConsoleLogHandlerFirebugLogHandlerSimpleRemoteLogHandler

Monday, November 29, 2010

Page 15: Advanced Performance Tuning in Ext GWT

Inherit logging module

<inherits name='com.google.gwt.logging.Logging' />

Configure Settings

<set-property name="gwt.logging.logLevel" value="SEVERE" /> <set-property name="gwt.logging.enabled" value="FALSE" /> <set-property name="gwt.logging.consoleHandler" value="DISABLED" />

Logging Configuration

Monday, November 29, 2010

Page 16: Advanced Performance Tuning in Ext GWT

Create loggers

private static Logger childLogger = Logger.getLogger("ParentLogger.Child"); private static Logger parentLogger = Logger.getLogger("ParentLogger"); private static Logger rootLogger = Logger.getLogger("");

Logging Usage

Monday, November 29, 2010

Page 17: Advanced Performance Tuning in Ext GWT

// Change the level of the logger @UiHandler("levelTextBox") void handleLevelClick(ChangeEvent e) { Level level = Level.parse(levelTextBox.getItemText( levelTextBox.getSelectedIndex())); logger.log(Level.SEVERE, "Setting level to: " + level.getName()); logger.setLevel(level); } // Log a message to the logger @UiHandler("logButton") void handleLogClick(ClickEvent e) { Level level = Level.parse(logTextBox.getItemText( logTextBox.getSelectedIndex())); logger.log(level, "This is a client log message"); } // Trigger an exception and log it to the logger @UiHandler("exceptionButton") void handleExceptionClick(ClickEvent e) { try { Level n = null; n.getName(); } catch (NullPointerException ex) { logger.log(Level.SEVERE, "Null Exception Hit", ex); } }

Logging Usage

Monday, November 29, 2010

Page 18: Advanced Performance Tuning in Ext GWT

Logging Example

Monday, November 29, 2010

Page 19: Advanced Performance Tuning in Ext GWT

Firebug for Firefox

Monday, November 29, 2010

Page 20: Advanced Performance Tuning in Ext GWT

Firebug for Firefox

The must have tool for all GWT developersDOM inspection and manipulationProfiles JavaScript code helping you find hotspots in your codeNetwork monitorCompile in the “pretty” style so JavaScript is readable

Monday, November 29, 2010

Page 21: Advanced Performance Tuning in Ext GWT

Firebug ProfilerMonitor method calls and execution timesStep into problematic code

Monday, November 29, 2010

Page 22: Advanced Performance Tuning in Ext GWT

Firebug Network PanelMonitor all server side requestsPinpoint bottlenecks

Monday, November 29, 2010

Page 23: Advanced Performance Tuning in Ext GWT

SpeedTracer

Monday, November 29, 2010

Page 24: Advanced Performance Tuning in Ext GWT

Identify and fix speed problemsBoth server and client side supportChrome ExtensionNetwork Usage

SpeedTracer for Chrome

Monday, November 29, 2010

Page 25: Advanced Performance Tuning in Ext GWT

SpeedTracer Example

Monday, November 29, 2010

Page 26: Advanced Performance Tuning in Ext GWT

Questions?

Monday, November 29, 2010

Page 27: Advanced Performance Tuning in Ext GWT

Thanks!Twitter @darrellmeyer

Portions of this presentation from the GWT documentation licensed under the Creative Commons Attribution 3.0 License

Monday, November 29, 2010