Design goals for NerdDinner
In Chapter 3, Developing Dockerized .NET and .NET Core Applications, I extracted the NerdDinner home page into a separate component, which enabled rapid delivery of UI changes. Now I'm going to make some more fundamental changes. The data layer in NerdDinner uses Entity Framework (EF), and all database access is synchronous. A lot of traffic to the site will create a lot of open connections to SQL Server and run a lot of queries. Performance will deteriorate as load increases, to the point where queries time out or the connection pool is starved, and the site will show errors to the users.
One way to improve this would be to make all the data access methods async
, but that's an invasive change - all the controller actions would need to be made async
too, and there is no automated test suite to verify such a wholesale set of changes. Alternatively, I could add a cache for data retrieval so GET
requests would hit the cache and not the database. That's also a complex...