DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Spring Microservice Tip: Abstracting the Database Hostname With Environment Variable
  • Spring Microservice Application Resilience: The Role of @Transactional in Preventing Connection Leaks
  • What Does Synchronization With Asyncio Look Like
  • Create a Multi-Tenancy Application in Nest.js, Part 4: Authentication and Authorization Setup

Trending

  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Event-Driven Architectures: Designing Scalable and Resilient Cloud Solutions
  • How to Convert XLS to XLSX in Java
  • Measuring the Impact of AI on Software Engineering Productivity
  1. DZone
  2. Data Engineering
  3. Data
  4. Performance Tuning in Microservices

Performance Tuning in Microservices

This article lists the 14 performance recommendations for developers of microservices to help when transforming from traditional Monolithic Architecture.

By 
Abhinav Pratap Singh user avatar
Abhinav Pratap Singh
·
Jun. 14, 21 · Opinion
Likes (11)
Comment
Save
Tweet
Share
22.3K Views

Join the DZone community and get the full member experience.

Join For Free

Microservices architecture offers various advantages over Monolithic Architecture, some of which are listed below:

  • Loosely coupled architecture.
  • Easy to scale based on demand.
  • Small individual services based on business functionality.
  • The technology stack of each microservice can be different.

However, when transforming from a traditional monolithic architecture to microservices, the common bottleneck is performance. According to Perforce Developer (Perforce Survey) Survey:

“The survey found that 33% of Java development professionals consider combined application performance to be the biggest challenge in microservices development. An additional 29% of respondents reported troubleshooting microservice-to-microservice performance as their biggest challenge.”

In this blog, I will list out the performance recommendations for developers of microservices:

  1. Reduce memory footprint of a microservice: Microservices footprint and business logic should be small. This way the performance will increase.
  2. Design Microservice Architecture for Performance and Security: A Microservice should be designed for a specific business requirement and should be designed for performance and security from start.
  3. Cache OAuth Tokens: OAuth tokens are costly, and time-consuming to generate and are used to secure microservices. Therefore, OAuth tokens should be cached by calling systems to avoid hitting the OAuth token generating API frequently. 
  4. Use Asynchronous Non-Blocking Requests wherever possible: Asynchronous requests are non-blocking.  Synchronous requests are blocking and can cause serious performance bottlenecks for other services. Asynchronous requests are non-blocking in nature and improve concurrency.
  5. Cache Database queries: Database queries and responses should be cached for non frequently changing data in the Database. This will reduce hits to Database and prevent the Database from getting overloaded. Use Indexing in Database RDBMS tables.
  6. Use Database connect pooling: Database connection pooling allows to use same Database connection for several requests. Making a new database connection is costly. Therefore, using database connection pools is recommended.
  7. Use Server-side caching:  It is recommended to use cache for caching the response of microservices depending on request parameters. For example, for a microservice giving out product details as a response, the response of the microservice can be cached based on input parameters passed. This will help in reducing the business logic inside a microservice from being executed and will give a response from the cache.
  8. Use best practices for the technology behind microservice business logic: Design and build optimized code for technology stack chosen for business logic behind microservices.
  9. Use the right data source: Microservices response time depends on Data source response time. Moreover, there are Data like structured(eg. Product name, description) and unstructured data(eg. Images, videos), which need to be stored in different data sources. Structured data should be stored in RDBMS systems, whereas unstructured data should be stored in No SQL data store like Cassandra.
  10. Use Search Engines like Solr/Endeca: Search engines give optimized and fast responses to requests. Therefore, use search engines to index and query data like products, prices, etc.
  11. Throttling the services: Throttling or fixing the number of requests that hit a service at a certain point in time helps in the availability of service. There are load balancing applications that handle this use case well.
  12. Scaling: Scaling up and scaling out are two recommendations to handle the increased load on microservice. Scaling up refers to increasing the memory of a single node. Scaling out refers to increasing a new node to service the requests. The above approach in combination with load balancing handles loads well.
  13. Use Database clustering: Database clustering with load balancing allows the database to give a faster response to queries.
  14. Reduce background processes: Certain microservices are required to perform some background logic. This logic should be kept separate from microservice nodes and should be performed asynchronously.

To summarize, if the approach of designing keeping performance in mind, it would yield better performing and available microservices. 

microservice Database connection

Opinions expressed by DZone contributors are their own.

Related

  • Spring Microservice Tip: Abstracting the Database Hostname With Environment Variable
  • Spring Microservice Application Resilience: The Role of @Transactional in Preventing Connection Leaks
  • What Does Synchronization With Asyncio Look Like
  • Create a Multi-Tenancy Application in Nest.js, Part 4: Authentication and Authorization Setup

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!