BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Articles Review and Interview with Dean Hume - Author of Fast ASP.NET Websites

Review and Interview with Dean Hume - Author of Fast ASP.NET Websites

Fast ASP.NET Websites, authored by Dean Hume, enables you to learn different ways to enhance the performance of ASP.NET and MVC applications.

The book is divided into 12 chapters spread across 3 parts (defining performance, General performance best practices and ASP.NET-specific techniques). The first chapter examines the need for optimization along with a coverage of various impact scenarios such as business, search engine ranking, mobile user and environmental.

The author examines the steps required to optimize a website, with a performance cycle diagram, besides pointing out where you need to optimize. He points out core factors such as profile, identity, implementation and monitoring which will be discussed in the upcoming chapters of the book.

Hume briefly examines the concept of front-end optimization, which he considers as a golden performance rule. He also suggests developers optimize the back-end code as it will play an important role in high performance applications.

In chapter 2, you will learn the basics of HTTP, the concept of empty and primed caches, in addition to the various tools to interpret waterfall charts and diagrams. He specifically points out the use of the F12 developer hot key.

Towards the end of this chapter, the author outlines the 14 golden rules for faster front-end performance, which were originally coined by Steve Souders, author of High Performance Web Sites. For instance, rule 3 advises you to add an “expires” header and rule 9 prompts you to reduce DNS lookups.

The book than moves to look at general performance best practices.

Chapter 3 examines the concept of compression and its various types such as Gzip, Deflate, and SDCH. The author has covered the need for compression, its pros and cons and the use of Accept-Encoding.

The chapter also examines the steps required to add compression via IIS and its web.config file. Hume also discusses some of the other methods such as the use of a few NuGet packages and custom-written libraries. However, he doesn't provide specific details about these libraries and strongly advises you not to use any of them.

Chapter 4 talks about HTTP, IIS caching and the related web.config settings in addition to a few other considerations such as file renaming for instant cache updates.

Towards the end of this chapter, the author examines the concept of output caching using a sample application with the help of comprehensive explanations and relevant source code.

Chapter 5 examines the concept of minification and bundling with special reference to the new features in ASP.NET 4.5. It also includes coverage of the steps required to utilize bundling in ASP.NET MVC and Web Forms with the help of screenshots and supported source codes.

In chapter 6, you will learn where to position CSS and JavaScript to achieve the best performance with the help of meaningful diagrams. Hume examines rendering issues which might occur when the order of styles and scripts is modified, along with coverage of HTML5 browser support, asynchronous JavaScript, web workers and application caches using both MVC and Web Forms applications.

The author has discussed both online and command line image optimization tools such as Smush.it, Kraken and pngcrush in Chapter 7. You will also learn the use of the Image Optimizer Visual Studio extension, data URIs and the role of image dimensions in the performance of applications, with the help of relevant HTML tags.

The next chapter discusses the use of ETags and the relevant steps to remove them in ASP.NET Web Forms and MVC applications. The author displays the results of the Yahoo! YSlow performance score before and after removing ETags with the help of real time screenshots.

Chapter 9 examines the concept of Content Delivery Networks and domain sharding. The chapter offers a comparison of results before and after the activation of CDN. It also provides a list of reliable CDN providers.

The final section of the book examines ASP.NET-specific techniques. Chapter 10 and 11 provide a detailed overview of the various steps required to tweak the performance of ASP.NET MVC and Web Forms applications. The author discusses the following concepts:

  • Release mode and debug mode
  • Use of favicon and code profiler
  • web.config settings
  • Difference between Response.Redirect and Server.Transfer

The last chapter provides a brief overview of server side caching, System.Runtime.Caching namespace and distributed caching. Hume also demonstrates the steps required to apply caching to the sample Surf Store application.

The author has uploaded two different versions of the project created for the purpose of this book that enable developers to assess the performance of the application before and after the application of optimization.

The book includes two appendices that examine the steps required to set up a local server with IIS and additional resource links mentioned throughout the book.

Fast ASP.NET Websites will be useful for those developers who would like to optimize ASP.NET applications for enhanced performance. In short, the book is a ready reckoner for emerging .NET developers. I would also though consider it a must read for all ASP.NET developers since visitors are more inclined to stay on your site if it loads faster.

You can download a free sample chapter of the book, and purchase a copy from Manning Publications.

InfoQ had a chat with Hume to find out more about the book.

InfoQ: What prompted you to write Fast ASP.NET Websites?

After visiting conferences such as Velocity, which are aimed at web performance, I realized that the .NET community was in need of a back to basics guide on web performance for ASP.NET applications. This book offers a chapter by chapter guide to improving the performance of your application. Whether you are a seasoned developer or just starting out - the fundamentals covered in this book will help you build fast websites.

InfoQ: In Chapter 2, you talk about caches. Does it play a crucial role in ASP.NET?

Chapter 2 runs through the basic tools and skills that you need to know in order to start analyzing your website. One of the areas that it covers is the basics of HTTP, including HTTP caching, which is an important part of the web, not just for ASP.NET developers, but for anyone developing for web in any language!

InfoQ: You talk about performance rules in the book. Is it necessary for a developer to follow them?

I think that most developers will at some point in their career come across a slow website that needs a bit of improvement in order to speed it up. By simply following performance rules as you develop your website, you ensure that you have a speedy website right from the start. Everybody loves a fast website!

InfoQ: Can you share with us the use of compression in ASP.NET applications?

Internet Information Services (IIS) has some great built in support for compression, it simply needs to be enabled in your application. There are so many sites that are out there that are running without compression, and with a few simple configuration steps it can make such a big difference to the performance of your site. There is some research that states that every day more than 99 human years are wasted because we spend our time waiting for web pages with uncompressed content. That’s an astonishing fact!

InfoQ: Can you share the difference between Minification and Bundling?

Minification can be applied to both CSS and JavaScript files and it simply removes and shortens any unnecessarily long code. Bundling CSS & JavaScript is an effective way to reduce the number of HTTP requests that a web page needs to make. By combining all JavaScript files into a single script, and similarly combining all CSS into a single Stylesheet you can severely reduce the number of HTTP requests that your web page makes. However, when you combine Minification and Bundling you get a double performance boost. ASP.NET has some great built in features that will automatically minify and bundle your CSS and Scripts for you.

InfoQ: In Chapter 8, you talk about ETags. In this context, how will a developer know the purpose of the generated tag code?

ETags are unique strings that are sent back in the HTTP response that help the browser identify and validate the browser cache. If used incorrectly they can actually be less efficient and in this book we explore ways of tweaking your application so that it performs at its best.

InfoQ: How does the use of CDN improve performance of websites?

A content delivery network (CDN) serves content to users with high availability and high performance. CDNs are distributed throughout the world and distribute your content to servers that are closest to your user. This means that if your user is in Mumbai, they get served from a server closest to Mumbai, instead of travelling half way around the world to a server in Europe, for example. This reduced distance greatly reduces network latency, which can make a big difference in improving the performance of your website. There is a great website called CDN planet that offers a list of affordable CDN providers. I recommend checking them out.

InfoQ: In chapter 10, you talk about favicons. What are the potential issues which might occur if favicons are not used properly?

In a high traffic ASP.NET application, you may find that by forgetting to add a favicon, you get the famous “The controller for path /favicon.ico does not implement IController” error appearing in your error logs. Most browsers will look for a favicon by default, and by not adding one, these unnecessary 404 errors cause disk reads and extra computation. While you may not notice this effect on a smaller website, a website with more traffic will take a hit in performance.

InfoQ: Are you aware of any other book which competes with your book?

There is a great book called High Performance Websites by Steve Souders. It provides practical tips and essential knowledge for developers. I wouldn’t say it’s competition but a must read for anyone who is interested in web development!

About the Book Author

Dean Hume is the author of the book Fast ASP.Net Websites, and the popular MVC HTML5 Toolkit. An avid blogger and contributor to various tech and coding websites, he brings a strong desire to constantly build his skillset and help do the same for those around him by writing, presenting, or training on various subjects.

Rate this Article

Adoption
Style

BT