13 A worked example of performance tuning

 

This chapter covers

  • Ensuring that your LINQ query translates into good SQL
  • Using EF Core’s DbFunction to improve a query
  • Building high-performance queries via raw SQL
  • Using cached values to improve performance
  • Trading development effort for performance gains

Section 12.1.2 showed that the book list query needs to have great performance, so this chapter is about performance-tuning that query. The query has already avoided nearly all the performance issues mentioned in chapter 12, so you must go beyond the normal changes to make any further improvements. This chapter takes you through a series of performance-tuning steps, starting with EF Core–focused approaches and then branching out to more-extreme changes to get the best performance possible.

The aim is to show you how to tackle performance-tuning an application, and the amount of effort needed to get that next level in performance. You may never need some of the extreme performance-tuning techniques covered here, but at least you’ll know that better performance is possible if you need it.

This chapter is divided into four distinct parts for improving the performance of the book list query:

13.1 Part 1a—Making sure a single query performs well

 
 
 

13.1.1 Analyzing the book list query to see potential performance issues

 

13.1.2 Turning the book’s Votes display into a client-side calculation

 
 

13.2 Part 1b—Improving the query by adding a DbFunction

 
 
 

13.2.1 Looking at the updated query

 
 

13.2.2 Ensuring that the query sorting and filtering are performing well

 
 
 
 

13.3 Part 2—Converting EF Core commands to SQL queries

 
 

13.3.1 Introducing Dapper

 

13.3.2 Rewriting MapBookToDto and associated EF queries using Dapper

 
 

13.4 Part 3—Modifying the database to increase performance

 
 
 

13.4.1 Creating an ActualPrice property—changing the promotion process

 
 
 
 

13.4.2 Caching the book review values, and not letting them get out-of-date

 
 
 

13.4.3 Calculating AuthorsString when a book is first created

 
 
 

13.4.4 Analyzing the changes—Is the performance gain worth the effort?

 
 
 

13.5 Comparing parts 1a, 1b, 2, and 3

 
 
 

13.6 Database scalability—what can you do to improve that?

 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage