download it
TRANSCRIPT
![Page 1: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/1.jpg)
Ajax Performance Monitor:A Toolkit for Web 2.0 Application Developers
Brian TooneSamford University
Birmingham, [email protected]
![Page 2: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/2.jpg)
What is Web 2.0?
Mind Map by Markus Angermeier
July 13, 2009 Brian Toone, Samford University Slide 2
![Page 3: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/3.jpg)
Our focus
Mind Map by Markus Angermeier
July 13, 2009 Brian Toone, Samford University Slide 3
![Page 4: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/5.jpg)
November 21, 2008 Brian Toone, Samford University Slide 5
![Page 6: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/7.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/8.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/9.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/10.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/12.jpg)
onmousemove Example, cont’d
July 13, 2009 Brian Toone, Samford University Slide 12
![Page 13: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/13.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/14.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/15.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/18.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/19.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/21.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/22.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/23.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/24.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/25.jpg)
Experimental Results
November 21, 2008 Brian Toone, Samford University Toone 25
![Page 26: Download It](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/26.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/27.jpg)
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](https://reader036.vdocuments.us/reader036/viewer/2022070316/555db531d8b42a63328b4fc7/html5/thumbnails/28.jpg)
Thank you!
Questions?For more information
[email protected]://faculty.samford.edu/~brtoone
July 13, 2009 Brian Toone, Samford University Slide 28