Download It

24
Investigating the impact of Ajax on server load in a Web 2.0 application Brian Toone Samford University [email protected]

Transcript of Download It

Page 1: Download It

Investigating the impact of Ajax on server load in a Web 2.0 application

Brian TooneSamford University

[email protected]

Page 2: Download It

What is Web 2.0?

Mind Map by Markus Angermeier

Brian Toone, Samford UniversityNovember 21, 2008 2

Page 3: Download It

Our focus

Brian Toone, Samford UniversityNovember 21, 2008 3

Mind Map by Markus Angermeier

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

November 21, 2008 Brian Toone, Samford University Toone 4

Page 5: Download It

November 21, 2008 Brian Toone, Samford University Toone 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 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

Page 7: Download It

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

Page 8: Download It

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

Page 9: Download It

Ajax 101

November 21, 2008 Brian Toone, Samford University Toone 9

Page 10: 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:

November 21, 2008 Brian Toone, Samford University Toone 10

Page 11: 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…

November 21, 2008 Brian Toone, Samford University Toone 11

Without Ajax With Ajax

Page 12: 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 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

Page 13: Download It

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

Page 14: Download It

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

Page 15: Download It

onmousemove Example, cont’d

November 21, 2008 Brian Toone, Samford University Toone 15

Page 16: Download It

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

Page 17: Download It

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

Page 18: Download It

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

Page 19: Download It

Integrating toolkit - clientside

November 21, 2008 Brian Toone, Samford University 19

Page 20: Download It

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

Page 21: Download It

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

Page 22: Download It

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

Page 23: Download It

Thank you!

Questions?For more information

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

Brian Toone, Samford UniversityNovember 21, 2008 Toone 23

Page 24: Download It

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