+ All Categories
Home > Documents > AJAX Performance and Monitoring - Software Summit · 2008-01-03 · Rod Bodkin — AJAX Performance...

AJAX Performance and Monitoring - Software Summit · 2008-01-03 · Rod Bodkin — AJAX Performance...

Date post: 10-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
51
Colorado Software Summit: October 22 27, 2006 © Copyright 2006, Glassbox Corporation Rod Bodkin AJAX Performance and Monitoring Page 1 AJAX Performance and Monitoring Ron Bodkin, Glassbox Leader [email protected]
Transcript

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 1

AJAX Performance and MonitoringRon Bodkin, Glassbox [email protected]

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 2

AgendaAJAX OverviewAJAX TechnologyChallengesSolutions

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 3

AJAX…

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 4

Asynchronous JavaScript And XML A group of technologies: HTML, JavaScript and XMLStill HTML-based, but with JavaScript packages that make web pages feel more responsive Parts of a page fetch data and update without the major re-load everyone is used to Used correctly, Ajax brings the interactivity of good desktop apps to the Web, such as a spell checker that checks on the fly like Outlook.Ajax can be chatty, so it needs a good network and thoughtful design

AJAX Defined

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 5

Other OptionsFat Client

Most interactiveHard to distribute, maintain

HTMLEasy to write, most portableLess interactive especially on WAN

FlashWide deployment (>95%)… still mostly used for animationHarder to develop, integrate

Javaapplets had early promise, limited to a niche

Microsoft XAML/AvalonWindows Vista only… ask me in 2009

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 6

Why AJAX?Rich interactivity

Responsiveness like a desktop appLively siteEase of use

Browser-basedStandardsUbiquitousEasy update

Productive, usable, networked applications

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 7

Why Now?Technology maturedSuccessful large-scale applicationsEmergence of tools and frameworksEven as IE went from 95% to 85% share

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 8

New Interaction Patterns

Source: Adaptive Path

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 9

AgendaAJAX OverviewAJAX TechnologyChallengesSolutions

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 10

Enabling TechnologiesXMLHttpRequest

Allows asynchronous communication with serverGenerates events as data is received

JavaScriptBetter portability across major browsersStill a lot of conditional logic required

Dynamic updates to pageDOM gives full object accessinnerHTML attribute for modifying HTML inside a tag

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 11

Javascript (Browser) Librariesdojo (widgets, packaging, utilities, persistence)Prototype (framework)script.aculo.us (effects, widgets)AjaxTK/Apache Kabuki - Zimbra (widgets)Yahoo! User Interface Library (widgets)TIBCO General Interface (framework & tools)

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 12

Browser + Server FrameworksJava

DWR (Direct Web Remoting)Google Web ToolkitZKAjaxTagsAjax4JSF

PHPSymfonyAjaxAC

.NETAtlasAjax.NETMagicAjax.NET

Ruby on RailsPython: DjangoPerl

CatalystCGI::Ajax

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 13

Example: DWR 1.0 AJAX

Source: Getahead

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 14

Reverse AJAX: Automatic Updates

Server Browser

?UpdateScript

Event

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 15

Reverse AJAX: Polling

Server Browser

UpdateScript

Event

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 16

Reverse AJAX: Comet

Server BrowserStart

UpdateScript

Event

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 17

Reverse AJAX: Piggy Back

Server Browser

Reply

Request

Update

Event

Script

Often discussed, but who is implementing it?

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 18

Widgets, e.g., Google Web Toolkit

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 19

Direct Service IntegrationAJAXengine

GoogleMaps

CreditAgency

Webpage

OrderService

Mash-ups…

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 20

Indirect Service IntegrationAJAXengine

OrderService

Webpage

Aggregationserver

GoogleMaps

CreditAgency

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 21

Proxy Web Service IntegrationAJAXengine

OrderService

Webpage

Proxyserver

GoogleMaps

CreditAgency

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 22

AgendaAJAX OverviewAJAX TechnologyChallengesSolutions

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 23

AJAX Problem AreasExcess server requestsJavaScript problemsServer loadService fragilityIntegration server problems

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 24

Excess Server RequestsAdds complexity

One single action can generate a flood of requestsOr a handful of slower onesWhat happens if some are unreliable?One missing timeout can produce a huge backlog

Hard to Monitor End User PerformanceInitial page load time isn’t the issue…Can’t determine cause of requests without page analysis

Hard to correlate Requests with Pages let alone User Actions

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 25

JavaScript ProblemsNot as fast as compiled languages!Processing large data sets is hardEngines can do a lot of workBrowser portability is still an issue

May require digging into framework codeStateful UI’s: what interactions led to errors?

Debugging nested DOM/CSS/JS…AccessibilityHTTP limit of 2 simultaneous connections per server by default (configurable)

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 26

Server Load: Pre-AJAXShort spikes of activityLong pauses of inactivity “think time”Efficient for use of server sockets and threadsCan tax CPUDynamic pages integrate big static chunks

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 27

Server Load: AJAXInitial download of engine (static content)Bursts of activity (change of context)With more frequent updates Typically shorter less intensive interactionsFrequent requests and polling usenetwork, CPU, sockets, and threadsComet instead uses much more sockets and typically threads and buffersMore demanding of client tooMore static content

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 28

Service FragilityEach service is a possible point of failure

OutagesConfiguration problemsChanges to service

Cascading slowness possibleNot meeting SLATests robustness/race conditions in browser

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 29

Integration Server ProblemsSlow database queryToo many queriesBottlenecks from aggregating many services

memory, sockets, …

Contention for locks in server…lots of threads for one session

Outages/misconfiguration… Traditional problems in a new context

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 30

Typical Application Problems

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 31

AgendaAJAX OverviewAJAX TechnologyChallengesSolutions

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 32

The Performance Lifecycle

Define• Service level

Operate• Monitor• Update

Design• Load test architecture

• Create budget

Develop• Code & debug

• Unit tests

Test• Load test often• Multi-platform

Troubleshoot

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 33

Architecture Is KeyAJAX shuffles the deck

Changed workloadsEmerging, immature technologies

Allocate work sensiblyInforms basic goals and SLA’s

Budgets for both latency and scalabilityInteractive events (heavy & light)Update callbacks

Prototype basic elementsMany new technologies at play

Extrapolate to model performance

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 34

Server OptionsThe usual suspects…

Java EE (Tomcat, JBoss, Jetty, GlassFish, WebSphere*, WebLogic*…).NET for Windows*LAMP

Emerging networking optionsGrizzly event-based HTTP Connector (in GlassFish)COMETd (Perl)Twisted (Python)Scala, Erlang/OTP (Concurrency Oriented Languages)Apache 2 Event MPMContinuation support…

* Indicates cost to use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 35

Emerging Standards?The Jetty open source Java Web container:

Uses NIO to only use threads when processing I/OServer requests set up a continuation

If waiting for data, they suspend by throwingWhen data is available, they are resumedThe server replays the processing, but the next time they will continue

Continuations allow using one thread per active requestAlso uses NIO split buffers to limit buffers for many requestsDWR 2’s Reverse AJAX

works with Jetty continuationsSupports polling & COMET

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 36

ContinuationsObject to represent the state of program execution

Native support in dynamic languages like Ruby, SmalltalkJava options rely on specialized state

Jetty implementation supports AJAX scalabilityRequires no side effects in codeReplays state based on request state & session stateDoesn’t checkpoint session state…

Other frameworks use to simplify conversationsRIFE framework for JavaSeaside framework for Smalltalk

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 37

IDE SupportEclipse

ATF (editor, debugger)MyEclipse * (editor, code assist, debugger)Aptana * (code completion)

IntelliJ IDEA* (refactoring editor)

* Indicates cost to use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 38

Browser Development ToolsDebugging

Mozilla Venkman debugger & profilerMicrosoft Script Debugger for IE

InspectorsWebDeveloper toolbar for Firefox: CSS, inspectorFireBug console viewer, inspector, debuggerMouseover DOM Inspector

Request monitoringFireBugGreaseMonkey: XMLHttpRequest Tracing/DebuggingEclipse ATF

Logging: MochiKit, dojo… server-side?

* Indicates cost to use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 39

Venkman Profiling Output33 <http://localhost:8080/glassbox/dwr/util.js>util.js: 750 - 2500 milliseconds

Function Name: anonymous (Lines 294 - 375)Total Calls: 6930 (max recurse 0)Total Time: 2093.01 (min/max/avg 0/10.02/0.3)Time (ex. calls): 1011.45 (min/max/avg 0/10.02/0.15)

35 <http://localhost:8080/glassbox/js/troubleshooter.js>troubleshooter.js: 750 - 2500 millisecondsFunction Name: loadRowInfo (Lines 78 - 83)Total Calls: 99 (max recurse 0)Total Time: 2293.3 (min/max/avg 20.03/40.06/23.16)Time (ex. calls): 0 (min/max/avg 0/0/0)

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 40

Unit TestBaseline test for functionality AND performanceIn browser

Script.aculo.us, JsUnit, ASTUce

JavaScript unit testsRhino, MS Windows Script HostJavaScript Coverage Validator (beta)*

On serverJUnit, NUnitJava Coverage: Emma, Cobertura, Clover*

* Indicates cost to try or use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 41

System TestFunctional system tests (in browser)

Script recording and playback validation• Selenium, Squish/Web*

Script code objects (e.g., for JUnit)• Waitij/Waitir (Win/IE scripting for Java/Ruby)

Load and Stress tests: simulate trafficOpenSTA (http/s only… confused by gmail)JMeter (http/s only)LoadRunner (http/s, script objects too)*

* Indicates cost to try or use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 42

ConfigurationTune based on Load TestNetwork

Load balancers, firewalls, routersOS level

Maximum socketsMaximum threads

Web serverTimeouts

Application serverThreadsTimeouts

VMMemory settings (e.g., -Xss thread stack size)

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 43

Systems MonitoringNetwork-level

Router, sniffer metrics: throughput, latencyEnd-user response time (not just http pings!)Customer Experience Management complicated: Keynote*, TeaLeaf*

OS-level : sockets, IO, processes, CPU…netstat, top, Nagios, Hyperic, HP Openview*, Tivoli*

* Indicates cost to try or use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 44

Using Fiddler: Mail Login & ViewYahoo Mail Beta

Request Count: 52Bytes Sent: 61,069Bytes Received: 165,677

…US West Coast (DSL -30KB/sec)Round trip cost: 5.20sElapsed Time: 12.20s

GmailRequest Count: 48Bytes Sent: 55,443Bytes Received: 51,044

…US West Coast (DSL -30KB/sec)Round trip cost: 4.80sElapsed Time: 7.80s

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 45

App Server MonitoringContainer

Server JMX: request queue, pools, throughput

Java VM with Java 5 JMX DataAll threads, memory

Key elementsthreads, memory, request queues, throughput, etc.

* Indicates cost to try or use.

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 46

App Monitoring with AspectsAspects run automatically at well-defined points at runtime No need to instrument codeAllows low overhead trackingEasy to update monitoring policies

Enable and disable, even samplingStandardized support

AspectJ load-time weaving avoids changes to build processPopular extensible language for Java 5 javaagentsSpring AOP allows proxy-based option for coarse-grained components

FlexibilityReuse open source monitors for common APIsEasy to extend for custom monitoring

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 47

Glassbox Open SourceJava 1.4+Discovers and tracks operationsas they executeLoad-time weavingLow overheadDetects common problems, e.g.

AJAX latency, loadExcess queriesSlow/broken Web services

WebServices

Any Database

AgentJava Virtual

MachineAOP

JavaApplication

WebServer

Application Server Machine

Client Machine

Browser

HTTP

Application

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 48

Troubleshooting Tools Provide

Benefits

Fix problems faster and cheaper by streamlining communication.

Fix more problems by enabling non-experts to track them down.

1. Aggressive data filtering can reduce the data haystack early

2. Troubleshooting intelligence means users need not be experts in the tool or have written the

system

3. Cleaner data and more accurate diagnoses streamline communication

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 49

Bringing It Together

DEMO

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 50

ConclusionsAJAX is now ready for prime time

Emphasize high-value interactivitySupporting technologies becoming mainstream

But test carefully and watch for shiftsFocus on architecture up front

Benchmark latency and throughputIntegrate monitoring and troubleshooting up frontWe’re looking for collaborators to build better AJAX monitoring & troubleshootingPlease leave your business card to get updatesThese slides will be updated on the post-conference CD

Colorado Software Summit: October 22 – 27, 2006 © Copyright 2006, Glassbox Corporation

Rod Bodkin — AJAX Performance and Monitoring Page 51

ResourcesAjaxian for News: www.ajaxian.comAjax Patterns for Technologies: ajaxpatterns.orgAjax: A New Approach to Web Applications: http://adaptivepath.com/publications/essays/archives/000385.phpAjax Impact on Server Scaling:www.zimbra.com/blog/archives/2006/04/ajax_impact_on.htmlScaling Connections for AJAX with Jetty 6: www.mortbay.com/MB/log/gregw/?permalink=ScalingConnections.htmlNot There Yet: COMET with Apache and Jetty: http://blogs.pathf.com/agileajax/2006/05/not_there_yet_c.htmlWhat I Didn’t Know About XHR: http://www.oreillynet.com/xml/blog/2006/10/what_i_didnt_know_about_xhr.htmlGlassbox: www.glassbox.com


Recommended