8 Practical Tips to Avoid Performance Problems
Kommentare

Three seconds: In this short time period a mobile website has to be loaded on a smartphone. Otherwise, 37 percent of the customers will terminate the loading process and use a different app from a competitor, as a current study by Compuware shows. On a desktop PC, there is a little more time, but after a few seconds the user will get impatient. So, it is crucial for organisations to guarantee short response and loading times of their desktop and mobile websites.

What has to be considered? Which application performance landmines are out there? And which measurements have to be taken to avoid them? Here are 8 practical tips for ensuring high-performance websites.

Lean Web Front Ends

Over the last years the average page delivered to customers has been steadily increasing in size and complexity as well as customers’ expectations of performance. Comparing the site performance to top competitors in the industry as well as internet leaders helps to set performance goals that can be achieved. The user action is the object that allows even to compare mobile native with web applications. For instance, one click on the search button of the web page can trigger 50+ web requests. One touch in the mobile app might just trigger 2 requests. For the user it does not matter how many requests are executed, he or she just wants the search results as fast as possible. So, the comparison should be done on the action level and not per web request.

Comparing your site against peers in the same industry will help you understand where you rank.

Comparing your site against peers in the same industry will help you understand where you rank. (Image: Andreas Grabner)

Additionally, understanding why customers leave the site can help to resolve customer experience issues: Is it a particular subset of customers who leave? Which page caused them to leave? Is there an application function that is bloated and slow? Using caching, compression, CDNs, and a check on every added image, function, and feature, organisations can trim the weight of their site and deliver a better customer experience. This is especially true for mobile websites. For instance, on the official website of the last Olympic Games, m.sochi2014.com, the landing page was a huge 3.6MB in total. 400k alone came from the HTML document, the rest was attributed by JavaScript, CSS and images.

Fast 3rd-Party Content and CDNs

With companies adding more content from third-party sources to their site, managing application performance becomes increasingly complex, even when these services are designed to improve performance. On Sochi’s mobile site the browser had to download 186 resources from 38 different domains. During peak performance events two primary trends can be seen: third-party services are overwhelmed when more than one of their customers reaches peak traffic simultaneously and CDNs buckle under large flash loads.

Monitoring and managing third parties means treating them as unique applications, with their own baselines and Service Level Agreements (SLAs) and Service Level Objectives (SLOs). Operation teams also need to be prepared for the scenario where a third-party service or CDN suffers a severe outage or begins to seriously degrade the site performance. These plans should include removing third-party tags, images, and content entirely as well as load balancing between multiple CDNs, moving content to a secondary cloud provider, and even switching to a simple bare bones site with all rich media removed.

Monitoring the impact of slow 3rd Party and CDN content on your page load time

Monitoring the impact of slow 3rd Party and CDN content on your page load time. (Image: Andreas Grabner)

For instance, one mobile website requires the user to download 87 resources (images, JS, CSS and HTML) from 25 different domains on its shopping cart page. An optimized site uses only half as many domains, speeding up overall page load time significantly. The slow page doesn’t download many more items. The main problem is that most of the .js and .css files are being redirected from the mobile domain to the regular domain. On the shopping cart page there are 28 roundtrips that would not be necessary. Especially on mobile devices this is a huge problem, because roundtrips are very expensive caused by high latency of the mobile network connection.

mobile websites

Mobile websites must be optimized to open as few connections as possible, downloading content from 25 different domains is too much. (Image: Andreas Grabner)

Few Database Calls

In the case of slow database access, often not the database is to blame but the access patterns of the application to the database. All too often a single web request queries thousands of database statements. There are multiple reasons for this: fetching too much data or inefficient fetching of data, which are aggregated and computed in the application rather than in a stored procedure. This problem pattern is not only seen in distributed applications running on modern application servers. It also happens on “legacy” applications such as VB6 or even the Mainframe. The following screenshot shows the transaction flow of an enterprise application that calls the mainframe. The mainframe makes 225 SQL executions per transaction. A closer look reveals that the same statements are called hundreds of times.

transaction flow

The transaction flow highlights how services interact with each other including the number of interactions to DB2, which indicate a potential architectural and performance problem. (Image: Andreas Grabner)

Besides these access pattern issues there are also individual statements that take very long to execute. In this case, it is not only important to focus on the database to optimize statements, but also to analyse whether these queries can be optimized from within the application. Too much data is often retrieved from the database, which first is parsed by the application (using extra memory) and then discarded afterwards (with more GC activity). Another landmine is a misconfigured connection pool or application code that holds connections too long and blocks other threads from accessing the database.

Database and connection pool

 The architects in this case started by optimizing SQL statements that took a long time to execute and those that got executed several times within the same transaction. (Image: Andreas Grabner)

Right Usage of Frameworks

In typical software projects it is very likely that most of the code comes from 3rd-party libraries such as Hibernate, Spring, Telerik RadControls, jQuery, ExtJS or GWT. But developers tend to include them in the enterprise applications without properly validating that the framework supports all use cases or whether it can scale and perform in the way needed. In many cases only a better configuration of these frameworks is required, such as the correct cache strategy for Hibernate or using different API functions that provide advanced features. Sometimes however it turns out that the choice of framework was wrong. Even with the right framework in place, organisations should update the implemented versions to benefit from improvements of their functionality, performance and stability. The next screenshot shows the performance of DOM element lookups using an older version of the Spry JavaScript framework. Even when opening the page on a modern Firefox browser these lookups contribute to about 3.5 seconds to the page load time:

Long running CSS class name lookups

Long running CSS class name lookups contribute about 80% to the client-side load time. (Image: Andreas Grabner)

It is especially important for mobile web sites to optimize JavaScript performance. On Sochi’s website there was a JavaScript library called knockout UI. Applied to the very large HTML page it took about 2 seconds to update the DOM with the dynamic UI information provided by this framework. And this time was measured on a laptop, so it was even slower on a mobile device. 

Javascript

JavaScript execution must be optimized for mobile devices. If it takes 1 second on a desktop it will be factors slower on a smart phone. (Image: Andreas Grabner)

Optimized Big Data

The amount of data, which has to be processed, is constantly growing. Big Data solutions provide new approaches to storing and processing large amount of data. But as with every technology it needs to be used in an optimized way to fit specific needs. One cannot process more data just by adding additional resources. This only works, if the jobs are implemented in a way that allows them to scale. The same problems as for relational databases also apply to accessing data in Big Data solutions. If there are inefficient queries or more queries than necessary, this is going to impact the performance.

The following screenshot highlights a transaction that spends most of its time in MongoDB. A closer look reveals that the framework used to access MongoDB makes a call to a size method of the cursor that executes an additional query to MongoDB, which is totally unnecessary. In this example, eliminating that call reduces roundtrips to MongoDB and improves overall transaction performance 15 times.

JourneyCollection.getCount

Transactions that call JourneyCollection.getCount spend nearly half their time in MongoDB. (Image: Andreas Grabner)

Good Network Infrastructure

Performance issues experienced by end users can have various origins and can be pretty costly. According to a report by the Aberdeen Group they can reduce revenue by 9% and productivity by 64%. When services are based on the SAP infrastructure the costs can rise to even $15,000 per every minute of a service downtime. Even though SAP provides tools to monitor its components, the proper application performance management (APM) solution should deliver a holistic view over the entire infrastructure. Only then can the operations team can tell whether it is a problem with SAP components or the infrastructure and therefore not related to the SAP or any application.

Overview of SAP tier

Overview of SAP tier with top most under-performing modules and most affected users. (Image: Andreas Grabner)

The most obvious hints on whether this is a network or an application problem can be seen by checking for the network and server time outliers compared to the values of the baseline traffic. But this is not enough to avoid problems. The first step towards proactive application performance management is to learn to respond promptly to alerts triggered by the APM tool when key metrics are outside the usual range.

Detecting Memory Leaks

Memory and garbage collection issues are still very prominent in most enterprise applications. Besides the traditional problems like high memory usage or wrong cache usage strategies, there are also memory issues related to class loading, large classes or native memory. The following screenshot shows the problem of having single objects consuming a lot of memory – for no apparent reason.

Memory leaks 

A single object is responsible for a big portion of the memory being leaked. (Image: Andreas Grabner)

Traditional memory leaks often lead to out of memory exceptions and crashes of virtual machines. This has a negative impact on the end user as the current context of user sessions and active transactions might be lost. High memory usage on the other hand can result in high garbage collection, which has a direct impact on the end user response time. Transactions that are suspended because of long-running garbage collection processing can be optimized by tweaking garbage collection settings and memory usage.

Smooth Cloud Services

Cloud services promise endless resources for endless scalability and performance when needed. But there are some pitfalls: Throwing hardware at an application that is not designed to scale in a cloud environment only generates unnecessary costs. Direct access to the underlying hardware, which is located with cloud providers, is not as easy as if the hardware is located in the next room. This makes troubleshooting or monitoring much harder. And the cloud is not only a resource pool of CPU, memory or disc-on-demand, it provides lots of other services such as storage or messaging. So, organisations must monitor the performance of these services, if they are key components of the application.

Feature image: Flat design modern vector illustration concept of website vis Shutterstock. Copyright: bloomua

Unsere Redaktion empfiehlt:

Relevante Beiträge

Meinungen zu diesem Beitrag

X
- Gib Deinen Standort ein -
- or -