Welcome!

Agile Computing Authors: LeanTaaS Blog, Kevin Jackson, Yeshim Deniz, Elizabeth White, Larry Alton

Related Topics: Agile Computing, Machine Learning

Agile Computing: Article

Top Ten Client-Side Performance Problems in Web 2.0

Top problems seen when working with our dynaTrace AJAX Edition users

Inspired by the Top 10 Performance Problems post which focuses on Server-Side performance problems taken from companies such as Zappos, Thomson, Monster and Novell I came up with the Top 10 Client-Side performance problems in Web 2.0 applications I’ve seen when working with our dynaTrace AJAX Edition users.

Symptom: JavaScript blocking resource downloads and slowing page load time
JavaScript opened the door for Web 2.0 applications. Since JavaScript is used on almost every web site traditional methods to analyze web site performance don’t always give you all the answers for a slow running page. Looking at a network waterfall diagram is the typical way to start analyzing a page and all its requests. Most browser performance tools support a network waterfall diagram. It shows which resources got downloaded and how much time the browser had to wait for all these resources to be downloaded.

In Web 2.0 applications it is no longer just the network downloads that contribute to the page load time. We start seeing blank spots between downloads where the browser is busy with other stuff. These blanks are usually explained with JavaScript execution where the browser stops all network activity:

Network Waterfall Diagram with blank spots that can be explained with JavaScript execution

Network Waterfall Diagram with blank spots that can be explained with JavaScript execution

Tools such as dynaTrace AJAX Edition or Google Speed Tracer allow analyzing these blank spots that block further network downloads as they analyze JavaScript execution, DOM access and Rendering activity in the browser while loading a page:

dynaTrace Timeline view shows what happens in these blind network spots

dynaTrace Timeline view shows what happens in these blind network spots

Long running JavaScript executed when JavaScript files are loaded cause the browser to suspend download of remaining network resources and therefore slows down the overall page load time.

Further Reading: Best Practices on Blocking and long running script tags

Top 10 Problems that explain these symptoms

The following is a list problems that explain most of these symptoms of long running and blocking JavaScript.

#1: Slow CSS Selectors on Internet Explorer
The #1 performance problem causing slow running or blocking JavaScript are slow running CSS Selectors in Internet Explorer. Web developers make use of lookup methods via CSS Selectors provided by JavaScript frameworks such as jQuery or Prototype. A common way to lookup elements is by using the CSS class name.

var element = $(“.shoppingcart”)

Internet Explorer 6 and 7 does not provide a native implementation for this lookup. jQuery/Prototype therefore needs to iterate through the whole DOM tree to perform the lookup purely through JavaScript. This iteration takes much longer than a native implementation provided in other browsers. The iteration is also heavily impacted by the DOM Size. The following image shows CSS lookups executed on a single page with the Total Execution Time (in ms) of these individual lookups on Internet Explorer. Many calls like this can make up several seconds on an individual page

dynaTrace AJAX analysis and highlights slow CSS Selectors

dynaTrace AJAX analysis and highlights slow CSS Selectors

Internet Explorer 8 provides better support for CSS Lookups. In order to take advantage of this it is important to upgrade to the latest versions of your JavaScript framework, e.g: jQuery/Prototype. Many websites are still stuck with older versions that do not leverage these new features making these pages also slow in the latest version of Internet Explorer.

Further Reading: Best Practices on Slow CSS Selectors with jQuery/Prototype

#2: Multiple CSS Lookups for same object
Individual CSS Lookups can be expensive. Executing the same lookup multiple times on the same page adds more execution time than necessary. Instead of executing the same lookup multiple times it is recommended to store the result of a lookup in a variable and reuse it on that same page. The following image shows the number of CSS Lookups for individual CSS Selectors on a single page. Some of them are called up to 10 times

dynaTrace analysis how often a CSS Selector got executed on a single page

dynaTrace analysis of how often a CSS Selector was executed on a single page

The 8 invocations to .ztBucket take a total of 660ms. Calling it only once and reusing the lookup result can reduce this total time to ~80ms

#3: Too many XHR Calls
JavaScript and XmlHttpRequests are the basis for what in general is called AJAX. Frameworks like jQuery make it very easy to make AJAX calls in order to retrieve additional content from the server. An example would be the implementation of a paging mechanism. Instead of downloading all pages at once only the first page is downloaded. When the user navigates to the next page we request the next page via an AJAX call and refresh the DOM. This avoids a full roundtrip and avoids the browser reloading the whole page.

A mistake that is often made is that too much information is fetched dynamically with too many calls. One example is a product page with 10 products. The developer may decide to use AJAX to load detailed product information for every product individually. This means 10 XHR calls for every 10 products that are displayed. This will of course work but it means that you have 10 roundtrips to the server that lets the user wait for the final result. The server needs to handle 10 additional requests that puts additional pressure on the server infrastructure.

Instead of making 10 individual requests it is recommended to combine these calls into a single batch call requesting the product details for all 10 products on the page.

Further Reading: AJAX Best Practices to reduce and aggregate XHR Calls, Best Practices on too many XHR Calls

#4: Expensive DOM Manipulations
Manipulating the DOM is necessary in highly interactive web sites. Dynamically loaded content needs to be added to the site or user preference changes need to be applied in order to change the look and feel of the website.

There are multiple ways to add new DOM elements – each with a different performance impact depending on the browser and the number of elements that are added. It is important to analyze different approaches (e.g: adding elements as HTML or creating individual DOM elements) and apply the approach that works best in each use case.

#5: Too many JavaScript files
The more JavaScript files there are on the page – the more often the browser needs to switch context with the JavaScript engine when loading these files. It is not uncommon to see web sites with 40 or more individual JavaScript files. Besides having additional context switches with the JavaScript engine the additional network roundtrips to download these JavaScript files have a significant impact on overall page load time.

A solution to this problem is merging individual JavaScript files into fewer. This saves on roundtrips and context switches for the JavaScript engine.

#6: Large DOM
The size of the DOM plays an important role in page performance. The larger the DOM:

  • the more memory is required by the browser
  • the longer manipulations take as style changes on top nodes need to be applied to more child nodes
  • especially on Internet Explorer larger DOMs have a disadvantage when performing certain CSS Lookups, e.g: by class name
  • any custom JavaScript that iterates through the DOM will become slower

Further Reading: Optimizing Data Intensive Webpages by Example

#7: Excessive Event Handler Bindings
Frameworks like jQuery, Prototype or YUI make it easy to bind event handlers to certain types of DOM elements, e.g.: all Hyperlinks. Binding event handlers to DOM elements impacts performance in 3 ways:

  1. the binding itself takes time as objects need to be looked up and are either registered to a central event manager or DOM elements are modified by assigning the handler method to it
  2. whenever an event is triggered the event manager needs to lookup the elements that have registered for that event and then call the correct event handlers (only true when using event managers)
  3. event handlers need to be unbound when moving to a different page. This has to be done in order to avoid any DOM-related memory leaks

The following image shows the internals of an event manager that needs to lookup all elements to identify which element to handle the actual event

Event Manager that needs to perform expensive CSS Lookups to resolve objects

Event Manager that needs to perform expensive CSS Lookups to resolve objects

#8: Slow executing external services
Many web pages embed external content (Ad Banners, Facebook Connect, …) or call external services (End User Monitoring, Review Information, …). This content is usually included by including a JavaScript file from this 3rd party provider. Very often these JavaScript files show common performance problems such as expensive CSS Lookups or DOM Manipulations. It is important to analyze 3rd party content and talk with 3rd party content providers to fix problems in their code in case it impacts web site performance. Often an upgrade to a newer version solves the problem. The following screenshot shows JavaScript execution that collects information for end-user monitoring purposes. It adds several hundred ms on each visited page and therefore impacts end-user performance:

Long running JavaScript code from a 3rd party library

Long running JavaScript code from a 3rd party library

#9: Excessive Visual Effects
Many JavaScript libraries provide nice visual effects, e.g: dynamic popup menus, accordion effects, etc. Where most of these frameworks do a good job on sample web sites, some of them do not perform well on real life pages with large DOMs. It is important to analyze the impact of visual effects on the browser’s CPU, the rendering engine and the overall web site performance

Further Reading: Performance Analysis of dynamic JavaScript menus

#10: Too fine granular logging and monitoring
Custom or third-party logging and monitoring frameworks allow the collection of very detailed information about user interaction. A common problem is that too much information is collected which results in additional overhead in the JavaScript engine as well as on the network as the collected data needs to be sent to a monitoring or logging service. Logging every mouse move for instance might seem like a good idea but can easily end up in blocking browsers (too much JavaScript execution) or congested services (too many logging calls to the monitoring/logging service)

Further Readings: How to Automate Google Analytics Analysis, Combining Analytics with Performance Management Data

Yes – there is more to Web 2.0 Performance Analysis
This list is by far not complete. For more information check out the blogs we wrote on JavaScript/AJAX, Best Practices from Google and Yahoo. Read what people like Steve Souders or John Resig have to say about web performance. There is also a great collection of web performance related blogs on Planet Performance.

Let me know what your top problems are and whether you would add or remove anything from my list.

Related reading:

  1. IE Compatibility View: How to identify performance problems between IE versions A client of ours recently contacted me with the question:...
  2. 6 Steps to identify the major web site performance problems on pages like masters.com Remark: The analysis in this blog was done on masters.com...
  3. Hands-On Guide: Verifying FIFA World Cup Web Site against Performance Best Practices Whether you call it Football, Futbol, Fussball, Futebol, Calcio or...
  4. How better Caching helps Frankfurt’s Airport Website to handle additional load caused by the Volcano Along with so many others I am stranded in Europe...
  5. Best Practices on JavaScript and AJAX Performance JavaScript can save your day or it can cause you...

More Stories By Andreas Grabner

Andreas Grabner has been helping companies improve their application performance for 15+ years. He is a regular contributor within Web Performance and DevOps communities and a prolific speaker at user groups and conferences around the world. Reach him at @grabnerandi

@ThingsExpo Stories
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
Digital Transformation (DX) is not a "one-size-fits all" strategy. Each organization needs to develop its own unique, long-term DX plan. It must do so by realizing that we now live in a data-driven age, and that technologies such as Cloud Computing, Big Data, the IoT, Cognitive Computing, and Blockchain are only tools. In her general session at 21st Cloud Expo, Rebecca Wanta explained how the strategy must focus on DX and include a commitment from top management to create great IT jobs, monitor ...
"Digital transformation - what we knew about it in the past has been redefined. Automation is going to play such a huge role in that because the culture, the technology, and the business operations are being shifted now," stated Brian Boeggeman, VP of Alliances & Partnerships at Ayehu, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
Recently, WebRTC has a lot of eyes from market. The use cases of WebRTC are expanding - video chat, online education, online health care etc. Not only for human-to-human communication, but also IoT use cases such as machine to human use cases can be seen recently. One of the typical use-case is remote camera monitoring. With WebRTC, people can have interoperability and flexibility for deploying monitoring service. However, the benefit of WebRTC for IoT is not only its convenience and interopera...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
Product connectivity goes hand and hand these days with increased use of personal data. New IoT devices are becoming more personalized than ever before. In his session at 22nd Cloud Expo | DXWorld Expo, Nicolas Fierro, CEO of MIMIR Blockchain Solutions, will discuss how in order to protect your data and privacy, IoT applications need to embrace Blockchain technology for a new level of product security never before seen - or needed.
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...