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.
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.
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 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.
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.
Right Usage of Frameworks
Long running CSS class name lookups contribute about 80% to the client-side load time. (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.
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.
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.
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