download it

28
Ajax Performance Monitor: A Toolkit for Web 2.0 Application Developers Brian Toone Samford University Birmingham, Alabama [email protected]

Upload: sampetruda

Post on 21-May-2015

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Download It

Ajax Performance Monitor:A Toolkit for Web 2.0 Application Developers

Brian TooneSamford University

Birmingham, [email protected]

Page 2: Download It

What is Web 2.0?

Mind Map by Markus Angermeier

July 13, 2009 Brian Toone, Samford University Slide 2

Page 3: Download It

Our focus

Mind Map by Markus Angermeier

July 13, 2009 Brian Toone, Samford University Slide 3

Page 4: Download It

Web 2.0 Example

FacebookPopular social networking web applicationWeb 2.0 application

Social software, encourages participation, sharing Convergence, 3rd party applications and most importantly for this talk … usability

July 13, 2009 Brian Toone, Samford University Slide 4

Page 5: Download It

Facebook

November 21, 2008 Brian Toone, Samford University Slide 5

Page 6: Download It

Usability enhancements

Reduce number of context switchesUser constantly sees context of page updatesNo browser busy icon or screen flickerMinimal change to the updated page

Reduce latency by potentially reducing server loadRetrieve only what is necessary to update the pagePotentially reduces amount of data fetched from serverPotentially reduces overall server load

July 13, 2009 Brian Toone, Samford University Slide 6

Page 7: Download It

Ajax 101

Ajax – Asynchronous Javascript And XMLAjax affects what happens after the initial page loadAjax-enabled page has Javascript code to submit additional HTTP requests asynchronously without refreshing the current page

July 13, 2009 Brian Toone, Samford University Slide 7

Page 8: Download It

Ajax 101 … without Ajax or Ajax-equivalent

Impossible to submit data without page refreshImpossible to update the display with new data from the server without page refreshImpact of a page refresh:

Brian Toone, Samford UniversityJuly 13, 2009 Brian Toone, Samford University Slide 8

Page 9: Download It

So far, so good, so what is the problem?

Facebook data requirements are relatively smallFacebook user interactions are relatively limitedConsider a mapping application…

Without Ajax With Ajax

July 13, 2009 Brian Toone, Samford University Slide 9

Page 10: Download It

The Ajax impact on server load

Without Ajax, user “encouraged” to use appropriate zoom tools to minimize thenumber of requestsWith Ajax, the opposite is true – the Rich Internet Application (RIA) “encourages” the user to prefer pan over zoomingPotential explosive increase in HTTP requestsWeb server must respond to each requestIncrease in bandwidth and processing load

July 13, 2009 Brian Toone, Samford University Slide 10

Page 11: Download It

An Extreme Example

Each Ajax request consumes server resourcesCPU cyclesNetwork bandwidthDisk I/O

Extreme ExampleAn onmousemoveevent initiates an Ajax request to retrieve data from the server.Every time every user moves the mouse, a new request is issued!

July 13, 2009 Brian Toone, Samford University Slide 11

Page 12: Download It

onmousemove Example, cont’d

July 13, 2009 Brian Toone, Samford University Slide 12

Page 13: Download It

Our Ajax Performance Monitoring Toolkit

See the server impact of Ajax calls in real-timeNot meant to be a stress tester, many already existHelp a web developer before the site is deployed

Measurement for the client (individual page)Measurement for the server (all accesses)Easy integrationMinimal overhead

July 13, 2009 Brian Toone, Samford University Slide 13

Page 14: Download It

The toolkit “heads-up display”

The same web page with instrumentation addedMinimal amount of code additionsCustomizable appearance (location, color, popup)

July 13, 2009 Brian Toone, Samford University Slide 14

Page 15: Download It

Client measurements

Requests sent / received / pendingResponse time statisticsRequest size statisticsThroughput statistics (requests issued per second)

July 13, 2009 Brian Toone, Samford University Slide 15

Page 16: Download It

Client measurements

Instrumented counters and timersAjax, arbitrary JavascriptClick to view statistics on a specific measurement

July 13, 2009 Brian Toone, Samford University Slide 16

Page 17: Download It

Server measurements

Requests received / processed / pendingResponse time statisticsResponse size statisticsThroughput statistics (requests processed per second)

July 13, 2009 Brian Toone, Samford University Slide 17

Page 18: Download It

Server measurements

Instrumented counters and timersArbitrary PHP code segmentsClick to view statistics on a specific measurement

July 13, 2009 Brian Toone, Samford University Slide 18

Page 19: Download It

Server measurements

Server load statistics1 minute cpu loadApache and MySQL process informationFree memory, free disk space, uptime

July 13, 2009 Brian Toone, Samford University Slide 19

Page 20: Download It

Integrating toolkit into web appsCLIENT SIDE

Javascript “include” file<div> for outputGlobal variable declarationInit global variable in onload function

SERVER SIDEMake sure each Ajax service script is isolated (cannot be loaded independently from an Ajax request)Include header and make function calls at the beginning and end of an Ajax service scriptDo not die()

July 13, 2009 Brian Toone, Samford University Slide 20

Page 21: Download It

Integrating toolkit - clientside

All-in-one request and response handler

Manual integration to existing code

July 13, 2009 Brian Toone, Samford University Slide 21

Page 22: Download It

Instrumenting client timers and counters

Place at any point in the Javascript codeEach timer and/or counter given a unique name

July 13, 2009 Brian Toone, Samford University Slide 22

Page 23: Download It

Integrating toolkit - serverside

Beginning of Ajax service script:

End of Ajax service script:

Instrumentation code:

July 13, 2009 Brian Toone, Samford University Slide 23

Page 24: Download It

Experimental Validation

Web app for retrieving elevation (Google Maps API)Ajax request issued with every mouse moveThree different Ajax requests compared

Random number generatorLocal database lookupExternal web service

Measure web browser response timeCompare Firefox vs Internet Explorer

November 21, 2008 Brian Toone, Samford University Toone 24

Page 25: Download It

Experimental Results

November 21, 2008 Brian Toone, Samford University Toone 25

Page 26: Download It

The Heisenberg Uncertainty Principle

(aka, measurement overhead)Namespace pollution

Client… AjaxPMServer… AjaxPM, apm_Mutex, apm_patSHMC, apm_server

Bandwidth impactClient-side ajaxpm.js (36kb)Polling mechanism for retrieving server statistics (500 bytes per developer configurable # of seconds)

Memory impactClient… 150 member variables (30 holding integers, 120 referencing DOM display elements)Client… Each instrumented counter/timer added to an integer arrayServer… 100kb of shared memory are allocated for server counters and timers

November 21, 2008 Brian Toone, Samford University Toone 26

Page 27: Download It

Conclusion

Real-time feedback on Ajax impact is possibleOverhead can be minimized but only marginally scalable … in other words, for developers only!

For our example application, Internet Explorer has better response time than FirefoxDownload and try it out!

http://faculty.samford.edu/~brtoone/

July 13, 2009 Brian Toone, Samford University Slide 27

Page 28: Download It

Thank you!

Questions?For more information

[email protected]://faculty.samford.edu/~brtoone

July 13, 2009 Brian Toone, Samford University Slide 28