Below are 19 best practices which can be used in a large scale applications for getting best performance results:
- Avoid writing business logic in the stored procedure which would otherwise be difficult to migrate your code to NoSQL world in future.
- BLOB or Files should never be stored in database. Instead we should be using file stream feature of SQL Server Database.
- Treat the transactional table in database to behave like NoSQL. Add column store indexes to very large tables (100 million+ records) to improve query performance in OLTP database.
- Frequently used table should be memory optimized.
- To improve IO performance, transactional table/indexes must be partitioned.
- Always use ORM to encapsulate Data Access.
- Always prefer to use code-first approach in ORM.
- To enable micro-services support , apply domain driven design concepts.
- Always segregate read and write operations in the repositories which exposes entities as collections.
- Always design implementations with appropriate interfaces implemented.
- Avoid writing business logic , workflows and roles in the controllers.
- Always use DI (Dependency Injection) , IOC (Inversion of Control) .
- Avoid rendering HTML at server side.
- Avoid using SOAP protocol in services.
- Avoid design REST endpoints to encapsulate business logic.
- Avoid depending on complex infrastructures like IIS.
- Prepare to use .NET CORE Runtime to build applications.
- Avoid using Cookies.
- Avoid using server side sessions especially in-memory sessions. Instead use distributed sessions.