Image Credits: https://chelseatroy.com

Performance Optimization Considerations for an Enterprise Application

Anji…
TechMonks
Published in
5 min readAug 22, 2020

--

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

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 and 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 the best and has excellent responsiveness and usability.

Before delving into the performance optimization techniques, let us understand what caching is 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 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 or computed and stored somewhere (In-memory data store or distributed store) to provide faster retrievals."

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

Days are gone when 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 the ‘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 them. It would be best if you considered the data or user/customer growth per year or month based on your application domain
  • Employ the APM tools to measure and monitor performance of the applications (adopting observability from the inception phase of an application avoids surprises at the end) and define the SLAs
  • Layout the performance practices and principles and manage them as a framework. The framework must be evolve based on the requirements
  • Define a checklist for developers and testers aligned with your SLAs and principles
  • Define a process that considers load and stress testing mandatory for every project.
  • Ensure the application is evaluated with large volumes of 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's business.

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

Below are a 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 or mechanism to load data on-demand as mandatory
  • Paging when dealing with large datasets
  • Identify the API modules or endpoints that require caching
  • Cache the data on the browser for applicable APIs using HTTP cache headers
  • Provide a 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 or library must be evaluated from a size perspective as well.
  • Load sections or widgets based on user settings or preferences only on the home page
  • Relational databases are complicated 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 the application warm-up instead of waiting for the user request

Application Development Level Considerations

  • Design and optimize the database model using indexes and other optimization 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 and pages
  • Use projection queries or other alternatives to avoid N+1 issue when dealing with ORMs
  • Minify the CSS and 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 the 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 helps you battle-test your application from day one.

Below are a few techniques

  • Automate your API testing
  • Measure the performance of each API to align with customer expectations or agreed-upon SLAs
  • Must prioritize 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 infrastructure 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 infrastructure configurations are similar across all the environments (Immutable Infrastructures)
  • Ensure your additional security and other layers are battle-tested before enabling them in the production environment. (I had these surprises a lot when I was working with the Infra and DevOps team)
  • Having multiple Smart Load balancers to avoid the single point of failure for your application. Load balancers can be employed in 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 the cloud provider team
  • The DevOps team and Development team must collaboratively work toward the application instead of working on their terms
  • Ensure everything is automated

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

--

--

Anji…
TechMonks

Technology Enthusiast, Problem Solver, Doer, and a Passionate technology leader. Views expressed here are purely personal.