Application Performance Optimization - HashedIn Technologies

Application Performance Optimization

Technology - 01 Sep 2017
Chandan Patel

How many times have you heard this line “My application is running slow, how to check what’s the problem?” At Least I have heard this line a lot of times. I will share my learnings on how to debug any application performance related issue. I will categorize this mainly in two parts (i.e. – Backend and frontend optimization).

Backend: There are different application monitoring tools which can help in troubleshooting the performance problem. My favourite is NewRelic. Following are some ways on how to get started with NewRelic for debugging any performance problem –

  1. Application Overview: This is one clear picture of application performance. Some of the important things that you can check here are web transaction time, apdex score, throughput and transaction. For more details read this.
  2. Transactions: This will help you in finding out some of the key transactions and time taken for those transactions. On this page, you can check which application url is most time consuming and have a complete breakdown on how much time is getting consumed at which level. For more details read this.
  3. Databases: Databases page shows top database operations by time consumed. It shows the throughput and average time taken for each query. For more details read this. One of the most important thing that you can do is enable slow query log once they are recorded you can find all slow queries under slow query tag at the bottom. read this for more detail.
  4. External Integration: External integration page records all out-of-process services such as web services, resources in the cloud, and any other network calls. You can find if there any integration which is consuming most of the time. read this for more details.

The performance of the system is heavily dependent on the amount of time we talk to the DB as the DB is bottleneck most of the time. Following are some of the important points that you should take care while dealing with any database related performance issues –

  • Never ever use queries inside FOR loop. Query all the data that you need and then do the parsing in memory
  • Use slow query logs and find out all slow queries
  • Make sure all the tables are properly indexed, it plays a big role in performance once you have huge amount of data
  • Write well formed SQL queries pay more attention to WHERE and GROUP BY clauses
  • Make sure that there are no subqueries within IN clause
  • Run EXPLAIN for all queries, number of row scanned and cardinality should be less
  • Connection should be pooled, with the use of connection pool you don’t need to create and destroy MYSQL connections every time
  • Use caches to store the reference data or very frequently accessed data
  • Tune mysql parameters for better performance, it becomes more important if your application deals with huge volume of data

Frontend – The best way to check any web page performance is by using google chrome profiler. You will get a pretty clear picture about any web page. There are also various online websites you can use for performance testing (i.e. – pingdomwebpagetest). Except that, the following are a few points that you should take care while debugging any page load performance issue –

  • Reduce number of HTTP calls to load a page
  • Place all of your Javascript at the bottom of your html file
  • Use server side rendering if you can, It will help to avoid AJAX calls
  • Keep all the stylesheet in the document HEAD element, this will help to load a page quicker since this allows pages to render progressively
  • Load JS files asynchronously
  • Use minify JS and CSS
  • Enable Gzip compression
  • Use sprite for combining images into one image
  • Use cache as much as you can
  • Reduce latency with a Content Delivery Network (CDN)

In case you are a WordPress user and If you’re looking for ways to speed up your WordPress site performance, then this article may help.

Free tag for commerce

E-book on Digital Business Transformation