performance optimization for ext gwt 3.0

43
Wednesday, November 2, 2011

Upload: sencha

Post on 14-May-2015

3.003 views

Category:

Technology


2 download

DESCRIPTION

Application performance is an important part of an application’s usability. This session will provide detailed information and tips to keep your applications running fast.

TRANSCRIPT

Page 1: Performance Optimization for Ext GWT 3.0

Wednesday, November 2, 2011

Page 2: Performance Optimization for Ext GWT 3.0

Sven Brunken

[email protected] @svenbrunken

Wednesday, November 2, 2011

Page 3: Performance Optimization for Ext GWT 3.0

OverviewWhy optimize an application?

What can you optimize?How to optimize it?

Questions

Wednesday, November 2, 2011

Page 4: Performance Optimization for Ext GWT 3.0

Why Optimize An Application?

Wednesday, November 2, 2011

Page 5: Performance Optimization for Ext GWT 3.0

Better User Experience

Wednesday, November 2, 2011

Page 6: Performance Optimization for Ext GWT 3.0

What Can You Optimize?

Wednesday, November 2, 2011

Page 7: Performance Optimization for Ext GWT 3.0

What Can You Optimize?Application loading timeApplication performanceMemory consumption

Wednesday, November 2, 2011

Page 8: Performance Optimization for Ext GWT 3.0

But, How To Do It?

Wednesday, November 2, 2011

Page 9: Performance Optimization for Ext GWT 3.0

Application LoadingGZip your contentCache your contentRemove not required filesObfuscate any external CSS and JavascriptReduce the amount of RPC calls on application startup

Wednesday, November 2, 2011

Page 10: Performance Optimization for Ext GWT 3.0

GZip Your FilesGWT has a pre defined Linker for thisSimply inherit the PrecompressLinker module

By default in gzips your html, js and css files

Wednesday, November 2, 2011

Page 11: Performance Optimization for Ext GWT 3.0

How To Reduce The Amount of RPC Calls?

Wednesday, November 2, 2011

Page 12: Performance Optimization for Ext GWT 3.0

How To Reduce It?Applications require to load multiple initial dataEach load makes a new round trip to the serverEach request contains a huge amount of dataAnd there is the HTTP protocol overhead

Wednesday, November 2, 2011

Page 13: Performance Optimization for Ext GWT 3.0

10 Requests At Page Load

Wednesday, November 2, 2011

Page 14: Performance Optimization for Ext GWT 3.0

10 Requests At Page Load

Wednesday, November 2, 2011

Page 15: Performance Optimization for Ext GWT 3.0

10 Requests At Page Load

Wednesday, November 2, 2011

Page 16: Performance Optimization for Ext GWT 3.0

Extra Data With Each Request

Wednesday, November 2, 2011

Page 17: Performance Optimization for Ext GWT 3.0

Extra Data With Each Request

Wednesday, November 2, 2011

Page 18: Performance Optimization for Ext GWT 3.0

Why Not Sending The Data With the Initial

Request?

Wednesday, November 2, 2011

Page 19: Performance Optimization for Ext GWT 3.0

AdvantagesNo further roundtrip requiredAll data on the client with the first page loadLess waiting time for the user

Wednesday, November 2, 2011

Page 20: Performance Optimization for Ext GWT 3.0

Extra Data With Each Request

Wednesday, November 2, 2011

Page 21: Performance Optimization for Ext GWT 3.0

Extra Data With Each Request

Wednesday, November 2, 2011

Page 22: Performance Optimization for Ext GWT 3.0

No More Request At Page Load

Wednesday, November 2, 2011

Page 23: Performance Optimization for Ext GWT 3.0

Demonstration

Wednesday, November 2, 2011

Page 24: Performance Optimization for Ext GWT 3.0

How To Do It?Serialize the data manually

String value = "Lorem ipsum dolor sit amet, consectetur ...";

ServerSerializationStreamWriter writer = new ServerSerializationStreamWriter(RPC.getDefaultSerializationPolicy());

writer.prepareToWrite();writer.serializeValue(value, String.class);

Wednesday, November 2, 2011

Page 25: Performance Optimization for Ext GWT 3.0

Put It Into The Main PageWe put the Data for all our calls into a Javascript Object<script>var dictionary = {<%String value = "Lorem ipsum dolor sit amet, consectetur ...";String[] methods = {"A","B","C","D","E","F","G","H","I","J"};

for (int i = 0; i < methods.length; i++) { ServerSerializationStreamWriter writer = ... out.print("\"call"+methods[i]+"\": \""+writer.toString().replaceAll("\\\\","\\\\\\\\" ).replaceAll("\"","\\\\\"" )+"\""); if(i<methods.length-1) { out.print(","); }}%> };</script>

Wednesday, November 2, 2011

Page 26: Performance Optimization for Ext GWT 3.0

Client Side Is Reading ItTaking advantage of the SerializationStreamFactoy classUsing the Dictionary to access our Javascript Object

SerializationStreamFactory factory = GWT .create(PerformanceService.class);

Dictionary d = Dictionary.getDictionary("dictionary");try { SerializationStreamReader r = null; r = factory.createStreamReader(d.get("callA")); String v1 = r.readString();

...

} catch (SerializationException e) { throw new RuntimeException(e);}

Wednesday, November 2, 2011

Page 27: Performance Optimization for Ext GWT 3.0

Application PerformanceDo not try to solve everything with WidgetsDo not run complicated logic on the clientDo not use more Widgets than requiredDo not create Widgets until needed

Wednesday, November 2, 2011

Page 28: Performance Optimization for Ext GWT 3.0

Widgets Are ExpensiveDo not use Widgets for everythingThey are expensiveTry to use plain HTML where ever possible

Wednesday, November 2, 2011

Page 29: Performance Optimization for Ext GWT 3.0

Only Simple LogicDo not try to solve complicated logic on the clientMake a server round tripDo not run code that is not requiredAnalyze your code to see if really only the required runs

Wednesday, November 2, 2011

Page 30: Performance Optimization for Ext GWT 3.0

Reduce The Widget CountDo not nest containers too deeplyOnly use the minimum amount of containers required

Wednesday, November 2, 2011

Page 31: Performance Optimization for Ext GWT 3.0

Too Many Not Required Containers

Wednesday, November 2, 2011

Page 32: Performance Optimization for Ext GWT 3.0

Too Many Not Required Containers

Wednesday, November 2, 2011

Page 33: Performance Optimization for Ext GWT 3.0

Same Looking, Less Containers

Wednesday, November 2, 2011

Page 34: Performance Optimization for Ext GWT 3.0

Same Looking, Less Containers

Wednesday, November 2, 2011

Page 35: Performance Optimization for Ext GWT 3.0

Demonstration

Wednesday, November 2, 2011

Page 36: Performance Optimization for Ext GWT 3.0

And This Has One More Advantage!

Wednesday, November 2, 2011

Page 37: Performance Optimization for Ext GWT 3.0

Reduced Memory Consumption

Wednesday, November 2, 2011

Page 38: Performance Optimization for Ext GWT 3.0

Before

Wednesday, November 2, 2011

Page 39: Performance Optimization for Ext GWT 3.0

Before

Wednesday, November 2, 2011

Page 40: Performance Optimization for Ext GWT 3.0

After, Same Functionality

Wednesday, November 2, 2011

Page 41: Performance Optimization for Ext GWT 3.0

After, Same Functionality

Wednesday, November 2, 2011

Page 42: Performance Optimization for Ext GWT 3.0

Questions

Wednesday, November 2, 2011

Page 43: Performance Optimization for Ext GWT 3.0

Thank You!

Wednesday, November 2, 2011