See the image below for a comparison Benchmark of using Sealed Classes vs Public Open Classes
Attributes: Benchmark by Nick Chapsas
Use the.Include() in your Query to reduce database round trip.
Big Websites like Amazon and IndieHacker.com might not be calling the database on publicly accessed web pages, instead, those are just static pages, generated or even heavily cached for fast access.
- This is because users do not care whether data is stale or not. They do not even know if it is fresh data or not. - But users do really care about speed. They will notice if the page is slow or not. If it is slow they abandon the page which you don't want to happen.
Make sure that you are only selecting the columns that you need. Use LINQ include. Utilize redistributed cache.
Reduce the number of times you call the database
Reduce the size of product images to under 2000
If you are using EF Core 7, look into TPT introduced in EF Core 7, this design avoids the round trip to the database when inserting into a parent table and need to use the primary key ID as a Foreign Key in other tables. What it does is insert a record into a child's table with respect to the Parent.
- Also look into using HiLow in the EF Core 6 to generate a sequence of IDs when inserting into the parent Table the Primary Key is already known. However, it is advised that you should be really careful when using HiLow, use it if you really need it.
Optimize the Server Response time by installing Varnish Cache - Use response Caching if you can, be careful not to cache sensitive personal data
Make sure you return the Cache period on all pages