We all want to build applications with excellent performance which could easily escalate to satisfy client requirements. These are my suggestions and basic tips that will help us avoid common mistakes.
My suggestions while developing and designing an app
1. Decrease database load
Avoid accessing the database and open transactions or connections, unless it is absolutely necessary.
2. Use all the cache possible
There is a clear hierarchical difference in efficiency in your app performance when we talk about cache: in-memory caches are way faster than disk caches, and these are faster than a remote access to a database or a network.
3. Don’t store volatile data permanently
We tend to place all the data in the database. But, is this absolutely necessary? Do we really need to store user session information in the database? Are we storing just the useful data? As a general rule for proper app performance, we just have to store critical and actionable business data in permanent media (hard disks, databases).
4. Place things only where they are going to be used
If in order to retrieve data, we need to go through a load balancer, web server, app server and a database instead of just a load balancer and a web server, then we are affecting the app scalability and performance.
5. Restrict the concurrent access to limited resources
Imagine we encounter with lost information in the cache, and we have to perform a lot of time consuming calculations in order to search for data. Even more, imagine 30 clients wanting the same information before the cache is completely full again. Then, we are going to have 30 clients accessing to the same data, doing the same operation. That’s the opposite of a best practice!
A simple way of solving this is to make the first client to perform the calculations while the rest of the clients simply wait for the outcome. Restricting the access to limited resources not only applies to reading operations but also to transactional operations.
6. Minimize network traffic
Our application has to have minimum communication with the network. The cost-benefit ratio of communicating through the network has to be deeply examined; we have to avoid heavy network traffic, unless we REALLY need it.
So there you go, apply these suggestions and you’ll see all the benefits. Maybe later I will post my tips for the specific case of an app developed with ASP .NET. Keep tuned and don’t miss any posts.