Transcript
Page 1: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

When It's Slow it Sucks

Lessons Learned From the Trenches

Page 2: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Good applications have at least one thing in common: they are really fast.

© outsystems 2012

Page 3: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

built-in agileplatform™

Page 4: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

viewstate reduction through R/W analysis partial screen rendering through visual AJAX

automatic AJAX queuing smart prevention of duplicated AJAX requests

automatic end-users activity monitoring

user interface logic database

agileplatform™

Page 5: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

unlimited horizontal scalability built-in distributed session management

automated batch processing scaling batch processes instrumentation & monitoring

integrations instrumentation & monitoring automatic monitoring of all errors

built-in logs rotation persistence of logs in bulk

asynchronous logging through messaging

user interface logic database

agileplatform™

Page 6: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

database connection pooling unused database connections unloading

optimized !elds fetch optimized dataset memory load

queries automatic instrumentation & monitoring primary & foreign keys automatic indexing

user interface logic database

agileplatform™

Page 7: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Beyond built-in agileplatform™ optimizations,

keep these performance best practices in mind.

Page 8: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

la Palisse truth

Page 9: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Creating indexes for the most used entity attributes will signi!cantly improve the performance of select queries

–  at the cost of slight overhead in insert and update operations.

la Palisse truth #1 Index your entities

Page 10: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lesson Learned From the Trenches

Page 11: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lesson Learned From the Trenches #1 Monitor your indexes

Uncover Hidden Data to Optimize Application Performance (Ian Stirk) http://msdn.microsoft.com/en-us/magazine/cc135978.aspx

SQL Server

Page 12: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Costly Missing Indexes –  Indexes that you may consider adding

•  Unused Indexes –  Not needed indexes (they hurt performance too)

•  Costly Used Indexes –  Indexes hurting insert / update operations

Lesson Learned From the Trenches #1 Monitor your indexes

Page 13: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Reorganization of indexes and statistics update –  Don't forget to involve the resident DBA.

la Palisse truth #2 Setup database maintenance plan

Page 14: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

the maintenance plan was being executed but…it was

stopping due to an error Inevitably, this was leading to performance degradation.

Lesson Learned From the Trenches #2 Ensure execution is being monitored

Page 15: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Avoid the use of 2000+ characters in a text !eld. –  Data !elds greater than 2000 bytes are converted into a Text data

type.

•  As a rule, isolate binary and/or large text !elds in separate entities

–  And only retrieve them when they are strictly necessary

la Palisse truth #3 Isolate large text and binary data

Page 16: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  allows fast and "exible indexing for keyword-based querying of text data

•  also, To search inside the binary !les stored in database using I!lters

How-to install, con!gure and use Full Text Search agile network

Lesson Learned From the Trenches #3 Use Full-Text Search

Page 17: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Cross server joins are very inefficient. –  The table in the linked server is completely loaded to the local DB in

order to perform the join.

•  May be acceptable if the tables are small and unavoidable.

la Palisse truth #4 Don't join over linked server

Page 18: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Apply the recommended settings from the installation checklist.

la Palisse truth #5 Con!gure web server memory settings

Page 19: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Affects user experience, therefore should be simple and fast to execute.

•  Also avoid using functions accessing the DB in Table/List Records.

la Palisse truth #6 Simplify screen preparations

Page 20: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Increases network traffic between the server and the browser.

la Palisse truth #7 Avoid using preparation data in screen actions

Page 21: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Use Service Studio’s build-in caching features (5.1+): –  Queries –  Actions

–  Web blocks –  Screens.

la Palisse truth # 8 Cache, baby, cache

Page 22: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

What about the lessons?

Page 23: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

la Palisse…The obvious

•  Index your entities •  Setup database maintenance plan •  Isolate large text and binary data •  Don't join over linked server •  Con!gure web server memory settings •  Simplify screen preparations •  Avoid using preparation data in screen actions •  Cache, baby, Cache

Page 24: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

80% of the end-user response time is spent on the browser

•  downloading all the components in the page:

images, .css, scripts, flash, …

•  The goal: Reducing the number of components in turn reduces the number of HTTP requests required to render the page

Page 25: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Let’s start with…

Page 26: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  The preferred method for reducing the number of image requests.

•  Group multiple images together (usually icons or decorative images) into one sprite.

•  Position the sprite to display the appropriate image by shifting the X or Y position by a multiple of the spacing.

Lesson Learned From the Trenches #4 CSS sprites

Page 27: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lesson Learned From the Trenches #4 CSS sprites

Enjoy the increased speed and reduced HTTP requests.

Page 28: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Moving stylesheets to the document HEAD makes pages  appear  to be loading faster, it allows the page to render progressively

•  The problem with putting stylesheets near the bottom of the document is that it prohibits progressive rendering in many browsers

•  Some browsers block rendering to avoid having to redraw elements of the page if their styles change.

Lesson Learned From the Trenches #5

Put Stylesheets at the Top

Page 29: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  The problem caused by scripts is that they block parallel downloads.

•  The  HTTP/1.1 speci!cation suggests that browsers download no more than two components in parallel per hostname.

•  While a script is downloading, the browser won't start any other downloads.

Lesson Learned From the Trenches #6

Put Scripts at the Bottom

Page 30: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lesson Learned From the Trenches #7 Minify CSS / JS !les

Page 31: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lesson Learned From the Trenches #7 really…minify it!

minifyjs.com jscompress.com

Page 32: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  JavaScript and CSS !les are cached by the browser.

•  JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. –  reduces the number of HTTP requests needed –  increases the size of the HTML document.

Lesson Learned From the Trenches #8

Make JavaScript and CSS External

Page 33: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Lessons Learned From the Trenches

Page 34: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  Monitor your indexes •  Ensure Database maintenance is being monitored •  Use Full-Text Search •  CSS sprites •  Put Stylesheets at the Top •  Put Scripts at the Bottom •  Minify CSS / JS !les •  Make JavaScript and CSS External

To keep in mind

Page 35: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

http://www.!ddler2.com/ http://yslow.org/ https://developers.google.com/speed/pagespeed/ http://www.websiteoptimization.com

search for…

Page 36: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

•  How to tune the TCP/IP stack for high volume of web requests agile network

•  Secrets to Building High Performance Apps nextstep11 presentation

•  Spriting made easy http://spriteme.org/

•  Automatic Performance Optimizations http://www.outsystems.com/demos

also search for…

Page 37: OutSystems - When it's Slow it Sucks: Lessons From The Trenches - NextStep 2012

© outsystems 2012

Thank You [email protected]

Credits shared with Paulo Ramos and Miguel Antunes


Top Related