DEV Community

anjireddy k
anjireddy k

Posted on • Originally published at Medium on

Performance Optimization Considerations for an Enterprise Application

Performance is an integral part of the Application design and plays a vital role in the success of your product/application. I would like to write a series of performance optimization techniques that help to design the best performant enterprise applications.

I would like to write a series of articles on performance. primarily there will be two parts. Part-1 talks about the performance considerations at the design / development level and Part-2 talks about the performance improvisation techniques.

To my understanding, performance optimization must be employed and evaluated at the below-mentioned stages/phases.

  • Application Design Level Considerations
  • Application Development Level Considerations
  • Application Testing and Deployment Considerations

Let us get started with the performance

Performance is the most important concern when designing applications. There are so many applications built around the same business domain. The clear winner would be the application that performs at the best and has excellent responsiveness and usability.

Before delving into the performance optimization techniques, let us understand what is caching and why it is a must for any application.

Adopting the cache into the application design helps to achieve the optimal performance of an application.

Below is the cache definition from the Wikipedia

In computing, a cache is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere.

Wikipedia

In simple words, “Cache is a technique where data will get preprocessed/precomputed and stored somewhere (In-memory data store or distributed store) to provide the faster retrievals

When a user requests the data, preprocessed data will get served instead of computing and serving the data on-demand. This improves the performance of the application at a larger scale.

Days are gone, where performance optimization of the application will be taken care of once done with the business implementation of the given requirement.

Performance optimization techniques/guidelines must be designed and employed from the project inception phase itself. As part of ‘Done’ definition of the user story, product owners must include the expectations from the responsiveness as well.

Below are a few policies recommended to be defined at the organization level and ensure these policies are considered as part of the application design/development.

Organization Level Policies

  • Capturing the operational requirements as mandatory for the project and designing your solution around it. You should consider the data or user growth per year/month based on your application
  • Employ the APM tools to measure/monitor performance of the applications (Adopting the observability from the inception phase of an application avoids surprises at the end) and define the SLAs
  • Layout the performance practices/principles and manage them as a framework. The framework must be evolving based on the requirements
  • Define the checklist for developers and testers aligned with your SLAs/ principles
  • Define a process that considers load and stress testing as a mandatory for every project.
  • Ensure application is evaluated with large volumes of the data

Following the defined practices leads to customer satisfaction and improves the quality of application at a greater level. Well defined strategies help you to optimize your application proactively before it impacts the customer business.

The Performance optimization framework (practices/guidelines) must be defined at the organization level and update it frequently with new findings and improvements. I believe, it is a good idea to have a performance inspector team, their whole and sole responsibility is identifying the performance issues in any given application.

Below are the few of the CORE Application Level Design considerations

Application Design level Considerations

  • Keep pages simple and lightweight. Home/Landing pages require special care
  • Define the SLAs at each module/page level (This must be reviewed at updated at regular intervals)
  • Identify the cache provider that meets your demands and design your cache framework around the chosen cache provider
  • Define framework/mechanism to load data on-demand as mandatory
  • Paging when dealing with large datasets
  • Identify the API modules/endpoints that require caching
  • Cache the data on the browser for applicable APIs using HTTP cache headers
  • Provide Multi-Channel interface (Desktop and mobile have different needs)
  • Adopt asynchronous calls when applicable
  • Minimize the service calls from the presentation layer by employing aggregated APIs
  • Ensure APM tools are enabled
  • As client-side applications are evolving, opt for client-side performance monitoring tools as well.
  • Evaluate SPA bundles before releasing them. Adding an external package/library must be evaluated from the size perspective as well.
  • Load sections/widgets based on user settings/preferences only on home page
  • Relational databases are very difficult to scale when dealing with huge concurrent requests. consider evaluating the No-SQL databases
  • ORMs always require special care. Avoid the N+1 issue by using projection queries/ named queries.
  • Explore the possibility of using read-only databases for ‘GET’ queries and master database for data modifications (Majority of Cloud providers support instant replication of data)
  • Build the cache as part of application warm-up instead of waiting for the user request

Application Development Level considerations

  • Design and optimize the database model using indexes and other optimizations techniques at the Database level
  • Apply the cache at the applicable layers (API, Business and DAO layers) using strict cache eviction policies
  • Employ HTTP cache headers for applicable endpoints/pages
  • Use projection queries or other alternatives to avoid N+1 issue when dealing with ORMs
  • Minify the CSS/JS using bundling techniques
  • Use compression algorithms to compress the data when transferring over the network
  • Load your JS or external packages on demand when possible
  • Consider using CSS sprites
  • Load the images when viewable in user viewport
  • Evaluate and explore the options to reduce your image sizes (you can employ techniques like lossy compression)

Testing Considerations

Defining and following the Automation, Load, and Stress Testing strategies help you to battle-test your application from day one itself.

Below are a few techniques

  • Automate your API testing
  • Measure the performance of each API to align with customer expectations or agreed on SLAs
  • Must prioritize the load testing and stress testing along with functional testing
  • Include strategies to validate the performance from geographical locations
  • performance must be considered as important as functional testing.

Deployment/Infrastructure strategies

This has a very important and high impact on the performance of an application. A simple network misconfiguration can cause much damage in terms of performance. An additional infra or network layer can delay your request from 10 milliseconds to 300 milliseconds.

Additional tools that you deploy over your application topology can negatively impact your application.

  • Make sure your infra configurations are similar across all the environments (Immutable Infrastructures)
  • Ensure your additional security/other layers are battle-tested before enabling them in the production environment (I have these surprises lot when I was working with Infra and DevOps team)
  • Having multiple Smart Load balancers to avoid the single-point-of-failure for your application. Load balancers can be employed the UI/client Application, API later and Database level
  • Configure all the required monitoring systems, log metrics, and other components of your application at the initial stage itself
  • Ensure your deployment architecture is reviewed by cloud provider team
  • DevOps team and Development team must collaboratively work towards of application instead of working on their own terms
  • Ensure everything is automated

References:

Image Credits:https://chelseatroy.com/2018/04/09/performance-optimization-an-example-implemented-in-ruby/

Thank you for reading the article and hope you have enjoyed it. If you have any suggestions or comments, please free to add in the comment box.

Please follow and like us:

Originally published at http://www.techmonks.org on August 22, 2020.

Top comments (0)