Welcome!

Agile Computing Authors: Elizabeth White, Yeshim Deniz, Pat Romanski, ManageEngine IT Matters, Liz McMillan

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
SYS-CON Events announced today that Calligo, an innovative cloud service provider offering mid-sized companies the highest levels of data privacy and security, has been named "Bronze Sponsor" of 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. Calligo offers unparalleled application performance guarantees, commercial flexibility and a personalised support service from its globally located cloud plat...
Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
"The Striim platform is a full end-to-end streaming integration and analytics platform that is middleware that covers a lot of different use cases," explained Steve Wilkes, Founder and CTO at Striim, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We are focused on SAP running in the clouds, to make this super easy because we believe in the tremendous value of those powerful worlds - SAP and the cloud," explained Frank Stienhans, CTO of Ocean9, Inc., in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
DX World EXPO, LLC., a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of 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. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" of 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. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...
"MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
"We've been engaging with a lot of customers including Panasonic, we've been involved with Cisco and now we're working with the U.S. government - the Department of Homeland Security," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
While the focus and objectives of IoT initiatives are many and diverse, they all share a few common attributes, and one of those is the network. Commonly, that network includes the Internet, over which there isn't any real control for performance and availability. Or is there? The current state of the art for Big Data analytics, as applied to network telemetry, offers new opportunities for improving and assuring operational integrity. In his session at @ThingsExpo, Jim Frey, Vice President of S...
SYS-CON Events announced today that DXWorldExpo has been named “Global Sponsor” of 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. Digital Transformation is the key issue driving the global enterprise IT business. Digital Transformation is most prominent among Global 2000 enterprises and government institutions.
In his opening keynote at 20th Cloud Expo, Michael Maximilien, Research Scientist, Architect, and Engineer at IBM, discussed the full potential of the cloud and social data requires artificial intelligence. By mixing Cloud Foundry and the rich set of Watson services, IBM's Bluemix is the best cloud operating system for enterprises today, providing rapid development and deployment of applications that can take advantage of the rich catalog of Watson services to help drive insights from the vast t...
SYS-CON Events announced today that EnterpriseTech has been named “Media Sponsor” of 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. EnterpriseTech is a professional resource for news and intelligence covering the migration of high-end technologies into the enterprise and business-IT industry, with a special focus on high-tech solutions in new product development, workload management, increased effic...
"We provide IoT solutions. We provide the most compatible solutions for many applications. Our solutions are industry agnostic and also protocol agnostic," explained Richard Han, Head of Sales and Marketing and Engineering at Systena America, in this SYS-CON.tv interview at @ThingsExpo, held June 6-8, 2017, at the Javits Center in New York City, NY.
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of 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. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of 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. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and ...
SYS-CON Events announced today that CHEETAH Training & Innovation 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. CHEETAH Training & Innovation is a cloud consulting and IT training firm specializing in improving clients cloud strategies and infrastructures for medium to large companies.
SYS-CON Events announced today that Datanami has been named “Media Sponsor” of 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. Datanami is a communication channel dedicated to providing insight, analysis and up-to-the-minute information about emerging trends and solutions in Big Data. The publication sheds light on all cutting-edge technologies including networking, storage and applications, and thei...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...