Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

22
Automated Client-Side Monitoring for Web Applications Shauvik Roy Choudhary, Alex Orso Georgia Institute of Technology

Transcript of Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Page 1: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Automated Client-Side Monitoring for Web Applications

Shauvik Roy Choudhary, Alex OrsoGeorgia Institute of Technology

Page 2: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Motivation

Paradigm shift from Web 1.0 to Web 2.0 Heavy client-side scripts From synchronous to asynchronous Multitude of client-side environments

New problems for testing

2Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 3: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Heavy client side scripts

More and more logic pushed to the browser (Javascript, Flash, Silverlight, …)

Little/no information on the server about client-side execution

3Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 4: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

From synchronous to asynchronous

Concurrency

Non-determinism

Additional complexity of testing environment

4Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 5: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Multitude of client-side environments Browsers Browser

Extensions

5

X

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 6: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

An Example Client Side Configuration

6

http://www.site.comURL:

Local Database

Extensions

Cookies

Page A

File Upload

Page B

Display Stats

Cookies

setCookie(“status”, “uploaded”)

Cookie used to track upload status

If (!getCookie(“status”)) { setCookie(“status”, “display”) reloadPage();}

Cookie used to check if stats should be displayed

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Developer/Tester needs client-side insight for

errors that might occur only in a particular

context

Page 7: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

A normal web application scenario

7

HTTP request

HTTP response

index.html

Internet

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 8: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Our monitoring technique

8

HTTP request

HTTP response

index.html

JS Agent

index.html

HTTP response

InternetJS

Agent

Injection policy

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 9: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Command and Control

9

JS Agent

HTTP request

Web Application Data

Command request

Monitoring Data Commands

Command response

Monitoring Data

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 10: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

What can commands do?

Query HTML DOM node (web page elements) Javascript objects, variables, arrays

Notify – Interact with user Display a message (HTML alert or layered dialog)

Update Add/Change a node in the HTML DOM Add more Javascript to page or change existing code

…10Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 11: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Command

1. <commands>2. <cmd>3. <id>8de9</id>4. <name>ALERT</name>5. <param>Hello World!</param>6. </cmd>7. <cmd>8. <id>3bsd</id>9. <name>DUMP</name>10. <param>myObj</param>11. <param>myArray</param>12. </cmd>13. </commands>

11Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 12: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Command

1. <commands>2. <cmd>3. <id>8de9</id>4. <name>ALERT</name>5. <param>Hello World!</param>6. </cmd>7. <cmd>8. <id>3bsd</id>9. <name>DUMP</name>10. <param>myObj</param>11. <param>myArray</param>12. </cmd>13. </commands>

12

Id:8de9

Alert(Hello

World !)

Id:3bsd

Dump(myObj)Dump(myArra

y)

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 13: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Response

1. <responses>2. <resp>3. <id>8de9</id>4. <status>1</status>5. </resp>6. <resp>7. <id>3bsd</id>8. <message>myObj={ "aString":"Howdy",

"anInteger":10,"aBoolean":true

}</message>9. <message>myArray=[1,"foo","web"]</message>10. </resp>11. </responses>

13Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 14: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Response

1. <responses>2. <resp>3. <id>8de9</id>4. <status>1</status>5. </resp>6. <resp>7. <id>3bsd</id>8. <message>myObj={ "aString":"Howdy",

"anInteger":10,"aBoolean":true

}</message>9. <message>myArray=[1,"foo","web"]</message>10. </resp>11. </responses>

14Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 15: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Response

1. <responses>2. <resp>3. <id>8de9</id>4. <status>1</status>5. </resp>6. <resp>7. <id>3bsd</id>8. <message>myObj={ "aString":"Howdy",

"anInteger":10,"aBoolean":true

}</message>9. <message>myArray=[1,"foo","web"]</message>10. </resp>11. </responses>

15

<script type="text/javascript"> myObj=new Object(); myObj.aString=“Howdy"; myObj.anInteger=10; myObj.aBoolean=true;</script>

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 16: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Sample Response

1. <responses>2. <resp>3. <id>8de9</id>4. <status>1</status>5. </resp>6. <resp>7. <id>3bsd</id>8. <message>myObj={ "aString":"Howdy",

"anInteger":10,"aBoolean":true

}</message>9. <message>myArray=[1,"foo","web"]</message>10. </resp>11. </responses>

16

<script type="text/javascript"> myArray=new Array(); myArray[0]=1; myArray[1]=“foo”; myArray[2]=“web”; </script>

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 17: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Preliminary evaluation

Goal: Measure agent-injection overhead and JS agent performance

Subjects: 10 applications – sample code, open source projects and commercial websites

17

echo framework

GoogleWeb Toolkit

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 18: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Experimental protocol

JSA injection overhead

JSA performance

18

http://www.site.comURL:

Iterate window

object and count

number of visited

elementsShauvik Roy Choudhary, Alex Orso | Georgia Tech

JS Agent

index.html

Main page

Measure time to

Inject the main page

Page 19: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

0

50000

100000

150000

Results

JSA injection overhead

JSA performance

19

Application # Objects

Time (ms)

Mail 1286 9

Showcase 4490 30

Chat Client 147 2

Number Guess

144 3

Interactive Test

147 2

Drupal 118 1

Joomla 229 3

Wordpress 176 3

iGoogle 618 6

Amazon.com

314 4

0.1 and 8 milliseconds per page window object iterated in 3-4 ms

Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 20: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Application Scenarios

Error Detection and Debugging Logging and Recovery

Metrics Collection Code Coverage Click-streams / User Activity Browser Statistics

Memory Profiling Count variables, arrays, objects

Security checks20Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 21: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Summary and future work Summary

General technique for remote monitoring of web applications

Proof-of-concept evaluation Example applications

Future work Complete implementation Investigate applications Additional experimentation

21Shauvik Roy Choudhary, Alex Orso | Georgia Tech

Page 22: Shauvik Roy Choudhary, Alex Orso Georgia Institute of Tech nology.

Thank you !

Any Questions ?

[email protected]://www.cc.gatech.edu/~shauvik

22Shauvik Roy Choudhary, Alex Orso | Georgia Tech