Post on 21-May-2015
Investigating the impact of Ajax on server load in a Web 2.0 application
Brian TooneSamford University
brtoone@samford.edu
What is Web 2.0?
Mind Map by Markus Angermeier
Brian Toone, Samford UniversityNovember 21, 2008 2
Our focus
Brian Toone, Samford UniversityNovember 21, 2008 3
Mind Map by Markus Angermeier
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
November 21, 2008 Brian Toone, Samford University Toone 4
November 21, 2008 Brian Toone, Samford University Toone 5
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 reducing server loadRetrieve only what is necessary to update the pageReduces the amount of data fetched from serverReduces overall server load
November 21, 2008 Brian Toone, Samford University Toone 6
Web Architecture 101
Web servers store web pages (static and dynamic)Web browsers use HTTP to request pages
Static page simply fetched from server hard driveScripts must execute to create dynamic pages (e.g., php, jsp)HTML document sent to the web browserImages, CSS, Javascript require additional HTTP requestsSame initial process for Ajax and non-Ajax pages
November 21, 2008 Brian Toone, Samford University Toone 7
Ajax 101
Ajax – Asynchronous Javascript And XMLAjax affects what happens after the initial page loadAjax-enabled page has Javascript code to submit HTTP requests asynchronously without refreshing the current page
November 21, 2008 Brian Toone, Samford University Toone 8
Ajax 101
November 21, 2008 Brian Toone, Samford University Toone 9
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:
November 21, 2008 Brian Toone, Samford University Toone 10
So far, so good, so what is the problem?
Facebook data requirements are relatively smallFacebook user interactions are relatively limitedConsider a mapping application…
November 21, 2008 Brian Toone, Samford University Toone 11
Without Ajax With Ajax
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 zoom and pan Potential explosive increase in HTTP requestsWeb server must respond to each requestIncrease in bandwidth and processing load
November 21, 2008 Brian Toone, Samford University Toone 12
Our focus and goal
Our focus is not to argue whether Ajax increases or decrease server load in general
That debate is meaningless because….The answer is entirely dependent upon…
Specific website implementation of Ajax functionality The overall usage of the site by the target audience
Our goal: a developer tool for quantifying the impact of Ajax performance on a web server hosting a specific Web 2.0 application
November 21, 2008 Brian Toone, Samford University Toone 13
An Extreme Example
Each Ajax request consumes server resourcesCPU cyclesBandwidthDisk 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!
November 21, 2008 Brian Toone, Samford University Toone 14
onmousemove Example, cont’d
November 21, 2008 Brian Toone, Samford University Toone 15
Our Ajax Performance Monitoring Toolkit
See the server impact of Ajax calls in real-timeNot meant to be a load tester, many already existHelp a web developer before the site is deployed
Measurement for the client (individual page)Measurement for the server (all accesses)
November 21, 2008 Brian Toone, Samford University Toone 16
What do we measure? (currently)
Client measurementsTotal number of Ajax calls made from an individual pageTotal number of Ajax responses received from serverTotal number of “pending” page calls still awaiting responses
Server load measurementsTotal number of Ajax calls processedTotal number of Ajax calls currently being processedThroughput (calls/min)
November 21, 2008 Brian Toone, Samford University Toone 17
Integrating toolkit into web appsCLIENT SIDE
Javascript “include” file<div> for outputGlobal variable declarationInit global variable in onload functionWrap Ajax request creation and cleanup
SERVER SIDEMake sure each Ajax service script is isolated (cannot be loaded independently from an Ajax request)Include the provided header and footer at the top and bottom of each Ajax service requestDo not die()
November 21, 2008 Brian Toone, Samford University 18
Integrating toolkit - clientside
November 21, 2008 Brian Toone, Samford University 19
Integrating toolkit - serverside
Not as much to show!Necessary monitoring code embedded in the header and footer scripts
November 21, 2008 Brian Toone, Samford University 20
Conclusion
Measuring the impact of Ajax calls is trickyThe Ajax Performance Monitoring toolkit can give a web developer real-time display of Ajax calls and impact on server load
November 21, 2008 Brian Toone, Samford University Toone 21
Future Work
Finer granularity of reported statistics (individual “named” Ajax calls)Better isolation of the specific Ajax impact on server load … count and report specific # of cpu cycles spent executing Ajax functionsLess dependence on web developer following conventions correctly (e.g., could have negative number of outstanding requests if developer calls cleanup multiple times per single request)
November 21, 2008 Brian Toone, Samford University Toone 22
Thank you!
Questions?For more information
brtoone@samford.eduhttp://faculty.samford.edu/~brtoone
Brian Toone, Samford UniversityNovember 21, 2008 Toone 23
Notes
• Min/Max/Avg CPU load for the entire time a user interacts with the page
• Min/Max/Avg CPU load for the most recent burst of activity (defined as delay > 5 seconds between user interaction)
• Real-time display of current server load– CPU load– Bandwidth
November 21, 2008 Brian Toone, Samford University Toone 24