Front-End Website Performance Optimisation Optimising the Front-End Performance of Swedbank’S Website
Total Page:16
File Type:pdf, Size:1020Kb
IT 13 062 Examensarbete 15 hp September 2013 Front-end website performance optimisation Optimising the front-end performance of Swedbank’s website Tobias Ericsson Institutionen för informationsteknologi Department of Information Technology Abstract Front-end website performance optimisation Tobias Ericsson Teknisk- naturvetenskaplig fakultet UTH-enheten The purpose of this study is to establish what techniques Swedbank can employ to improve the performance of their external website. Several optimisation techniques Besöksadress: for improving front-end performance are presented from user experience and server Ångströmlaboratoriet Lägerhyddsvägen 1 load perspectives. The website is then evaluated based on the principles identified to Hus 4, Plan 0 determine if and how it can be improved, whereupon testing is employed to determine the benefits of implementing these techniques. The evaluation shows that Postadress: the Swedbank website can be improved in several ways; the most important being to Box 536 751 21 Uppsala employ text file compression, caching headers and to combine images together. The report concludes that Swedbank should implement at least these three techniques as Telefon: they are the most cost-effective from both a user experience and server load 018 – 471 30 03 perspective. Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student Handledare: Henrik Wall Ämnesgranskare: Arnold Pears Examinator: Olle Eriksson IT 13 062 Tryckt av: Reprocentralen ITC 2 Abstract in Swedish Syftet med denna rapport är att fastställa vilka tekniker Swedbank kan använda sig av för att förbättra prestandan på sin externa webbsida. Flera optimeringsåtgärder för förbättring av front- end-prestanda ur användarupplevelse- samt serverbelastningsperspektiv presenteras. Webbsidan utvärderas sedan utefter de presenterade principerna. För att vidare fastställa eventuella fördelar med implementering av teknikerna så utförs ett flertal tester. Utvärderingen visar att Swedbanks webbsida kan förbättras på flera sätt, varav de viktigaste är komprimering av textfiler, kombinering av bilder samt ”caching headers”. Rapporten drar slutsatsen att Swedbank bör implementera åtminstone de tre nämnda åtgärderna, då de är de mest kostnadseffektiva i förhållande till det mervärde som uppnås både från ett användarupplevelse- och serverbelastningsperspektiv. 5 6 3 Table of Contents 1 Abstract ..................................................................................................................................... 3 2 Abstract in Swedish ................................................................................................................... 5 3 Table of Contents ...................................................................................................................... 7 4 Introduction .............................................................................................................................. 9 5 Theory ..................................................................................................................................... 10 5.1 Background ...................................................................................................................... 10 5.2 Minimise requests ............................................................................................................ 10 5.3 Request overhead ............................................................................................................ 12 5.4 Payload size ..................................................................................................................... 14 5.5 Parallelise requests .......................................................................................................... 15 5.6 Caching ............................................................................................................................ 16 6 Methodology ........................................................................................................................... 18 7 Results ..................................................................................................................................... 20 7.1 Application analysis .......................................................................................................... 20 7.2 Optimisation testing ......................................................................................................... 23 7.2.1 Combining Javascript files ......................................................................................... 23 7.2.2 Combining images .................................................................................................... 25 7.2.3 Static domain ........................................................................................................... 27 7.2.4 Shortening URLs ....................................................................................................... 28 7.2.5 Compressing text based files .................................................................................... 29 7.2.6 Minifying text based files .......................................................................................... 31 7.2.7 Loading scripts in parallel ......................................................................................... 32 7.2.8 Enabling caching headers ......................................................................................... 34 7.2.9 Combined optimisation techniques .......................................................................... 35 8 Discussion ................................................................................................................................ 37 9 Conclusions ............................................................................................................................. 39 10 Future work ......................................................................................................................... 41 11 Bibliography ......................................................................................................................... 42 12 Appendices .......................................................................................................................... 44 12.1 Appendix A – File breakdown ........................................................................................... 44 12.2 Appendix B – YSlow Site Evaluation .................................................................................. 45 12.3 Appendix C – WebPageTest Site Evaluation ...................................................................... 48 12.4 Appendix D – Test Results Averages ................................................................................. 51 7 8 4 Introduction Swedbank’s website is one of the most visited in Sweden and as no performance analysis has hitherto been performed on the website Swedbank is interested in discovering the current state of their website to determine if it employs sufficient performance critical techniques to provide their visitors with a good user experience. The aim of this report is to identify, describe and evaluate optimisation techniques for website performance from a front-end perspective. An evaluation of the current Swedbank website based on these techniques has been performed in order to determine if and how the site can be improved. The first part of the report provides an overview of a range of optimisation techniques which have been identified during a review of recent web optimisation research literature. The techniques address ways to improve performance by reducing the number of necessary content requests and the amount of data being sent and received, by optimising the order in which content is downloaded and by altering HTTP headers to improve how browsers handle them. The second part of the report consists of an analysis of Swedbank’s website based on the previously presented theory, as well as with the aid of two automatic website analysis tools. A list of possible ways to improve the site has been compiled, whereupon testing of each listed technique was conducted on a local copy of the Swedbank website in order to determine the potential implementation benefits of each technique. The test phase is followed by a discussion of what optimisation techniques are the most beneficial for Swedbank to implement, considering both the cost of implementation and the benefits of each technique established from the testing phase. The report concludes with final recommendations on what techniques are the most cost-effective and should therefore be implemented, both from a user experience perspective and a server load perspective. 9 5 Theory 5.1 Background In the world of web applications there are several different types of performance that can be measured: server performance, the speed at which the web server can serve requests; web performance, the measure of the time it takes for the application to be presented to the user; and runtime performance, the speed at which the application responds to user interactions [1]. The focus of this thesis is on the second of the three, web performance. When considering web performance it is important to keep in mind that a site load is not simply a question of one single serial download. The browser will first send a request to the web server to download the index document of the site, which in turn will reference many other elements that need to be downloaded in order for the page to render correctly.