15 Ways to Improve Your Web App Performance

Increase performance by optimizing database operations, using assets minification, CDN, API calls caching and more.

  • slide
  • slide
  • slide

15 Ways to Improve Your Web App Performance


This blog is mainly aimed to improve the performance of web applications and lists out some important tips for the better performance of web applications. There are different tips to improve the performance of our web applications. One of them is client side improvement tips and another is database operations.

Client Side

1.Cache API call

Using caching on a client side.

example:


self.getData = function (url, tryCache) {
if (tryCache) {
var cached = localStorage.getItem(url);
if (cached) {
var deferred = new $.Deferred();
var deserialized = JSON.parse(cached);
return deferred.resolve(deserialized);
} else {
var promise = self.ajaxTransport(url, { type: 'GET' });
promise.done(function (result) {
var serialized = JSON.stringify(result);
localStorage.setItem(url, serialized);
});
return promise;
}
} else {
return self.ajaxTransport(url, { type: 'GET' });
}};


The api call is,

$.when(xyz.dataManager.getData(urls.General.country, true);


Here the ajax call, the first time it will get the value from the database, the in the second time it will call. Initially, it will check the data is cached or not. If yes, it will not hit the database again.

2.Change to Release mode

During the final build for our application, please select the release mode which will build the application.The default mode is debugged.

3.Client side validation.

Use Client Side Validations for all possible fields.

4. Avoid all Recursive Functions and Nested Loops in the application.

5. Use "arraylists" in place of arrays.

6. Use "For each" Instead of For.

7. Optimize the assignments.

Use exp += value instead of exp = exp+value.The exp can be the arbitrarily complex, so it will make a lot of unnecessary work.

8.In String iterations, use ‘for’ loop.

The tradeoff for this generalization is speed, and if you rely heavily on string iteration you should use a For loop instead. Since strings are simple character arrays, they can be walked using much less overhead than other structures.

9. Use content delivery networks.

A server will store a copy of our site, and it will serve to whichever the location the user while viewing the form. When the user requests, the time it takes from the user first time requesting the site, the response of the server depends on the requested user location. When we using content delivery networks, it will work a little different to the above.Instead of you hosting, just one copy of your website, in cdn it will host multiple copies of it on the various different servers and that are located around different locations in the world.

10.CSS optimization.

One of the major problems of poor performance of web application is CSS files loading time. So we can avoid it by optimizing the CSS files. ie we should remove the unwanted CSS codes from our web application.

11. Use ajax call to updates in your UI, and avoid the whole page update as it possible.

12. Use minifi in javascript files, so you can improve the script size.

13. Reducing the number of requests to the server.-

In the web application, we use a lot of CSS files and static contents. So each file sends a request are being sent to the server. For a small application, it’s minimal, but a large web application, when the requested via the web server, it utilizes a lot of bandwidth over the network. So we can use bundle and minify these static content files to avoid this problem. Using this way the number of requests to the server can be reduced.

14. Optimizing the images.

The images are static contents, and they take bandwidth when we request via the web server. To solve this problem, reduce the size of the images.

In Database Operations

1. If retrieving too much data in your results, it is usually the result of inefficient queries. When we use the select * query, it will cause this problem. If you do not need to return all the columns in a row, then use like where clause in your queries to ensure that you are not returning too many rows. This means that you have taken only your need.

2. Reducing the number of requests to the server.

3. Avoid unmanaged codes.

In calls to unmanaged code is a high marshalling operation. We can reduce the number of calls between the managed and unmanaged calls.

4.While executing multiple operations, use multiple threads.

When we use single thread code for multiple operations, it will be stuck on long-running process.

5.Caching

Use caching, that allows us to store data in memory or another place, so we can retrieve it quickly. There are two methods for caching, external caching and in-memory caching.

6. We can use toll for performance tuning.

Tools are used for monitor the performance of the codes.
eg: Fiddler.

Conclusion

I hope this article is very useful for a beginner. I have covered some important tips to improve the performance of the web application. Improving performance is not a one day task. It takes iterative tasks to improve the performance. Initially, we need to understand the performance tips and then fix the issues.




Leave a Reply

Your email address will not be published.


Comment


Name

Email

Url



Get Free Consultation
From Our Experts !