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
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

Curious about the future of data-driven systems? Join our Data Engineering roundtable and learn how to build scalable data platforms.

Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.

Threat Detection: Learn core practices for managing security risks and vulnerabilities in your organization — don't regret those threats!

Managing API integrations: Assess your use case and needs — plus learn patterns for the design, build, and maintenance of your integrations.

Avatar

Eliran David

Works at Nielsen

Joined May 2018

Stats

Reputation: 150
Pageviews: 61.2K
Articles: 2
Comments: 13
  • Articles
  • Comments

Articles

article thumbnail
Spring Service: Improving Processing Time Could Harm Service Scalability
Learn more about improving processing speed in your Spring service.
October 10, 2019
· 27,318 Views · 11 Likes
article thumbnail
Servlet 3.0 Async Support in Spring and Performance Misconceptions
Learn how to improve your application's performance without increasing code complexity by simply tweaking Tomcat configurations.
Updated September 23, 2019
· 33,854 Views · 21 Likes

Comments

Spring Service: Improving Processing Time Could Harm Service Scalability

Jun 24, 2020 · Eliran David

hey Porter. agree. Today I am more familiar with WebFlux that allow you easily to make all your server I/O operations non blocking. Following your comment, using WebFlux, the number of threads is fixed (comparing to the traditional approach) so I will suggest to use that (when choosing between Java options) if your application has mainly I/O operations and should scale. See my new post that relate to that :)
https://medium.com/nmc-techblog/shifting-from-java-to-node-js-duel-to-the-death-b052fd7ac1d1

Spring Service: Improving Processing Time Could Harm Service Scalability

Jun 24, 2020 · Eliran David

hey Marc. Today I am more familiar with WebFlux, see my new post :)
https://medium.com/nmc-techblog/shifting-from-java-to-node-js-duel-to-the-death-b052fd7ac1d1

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Jun 24, 2020 · Eliran David

that's a good point GG GG. Tomcat can handle more than 600 because it maintain a queue of requests with no available threads, that's why we see more than 600 requests that got 200 OK. some of those requests in the queue got timeout because they were too much time in the queue waiting for a thread to serve them.
Today I am more familiar with WebFlux that allow you easily to make all your server I/O operations non blocking so I will suggest to use that (when choosing between Java options) if your application has mainly I/O operations and should scale. See my new post for more details:
https://medium.com/nmc-techblog/shifting-from-java-to-node-js-duel-to-the-death-b052fd7ac1d1

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Jun 24, 2020 · Eliran David

hey Adrian, the goal of making an endpoint async is to release the tomcat thread to do other stuff, but in the code examples I reviewed all other (TCP) operations were blocking, like calling third party service. Therefore we still have the problem of threads that are waiting and become a bottleneck. Today I am more familiar with WebFlux that allow you easily to make all your server I/O operations non blocking so I will suggest to use that (when choosing between Java options) if your application has mainly I/O operations and should scale. See my new post for more details:
https://medium.com/nmc-techblog/shifting-from-java-to-node-js-duel-to-the-death-b052fd7ac1d1

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Mar 27, 2020 · Eliran David

I think you can find the answer in my post. see the Callable example. Callable does not give threads as many as you need. When using Callable as return value, Spring will use its default spring thread pool (can be changed via spring configuration), which probably has more threads than ForkJoinPool. Log the thread ids to see it. Anyway, we would like to avoid the approach of "as many threads as we need" because that we will lead to CPU wasting too much time on context switch. You need to tune the number of threads, by monitoring, according to your use case.

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Mar 12, 2020 · Eliran David

Thank you Renier. Monitor the threads, perhaps you will find there a good explanation. The only thing I can think of is that your async code use more resources (assuming both are doing the same thing). Here are the Gatling simulations (scala):
https://github.com/elirandav/springAsyncServlet/tree/master/src/main/resources

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Mar 12, 2020 · Eliran David

Thank you Normandes. I don't think that return async will make the service scale better because in both approaches (async or not async), you need to decide on the number of pool's threads. The difference is that in not async you align only the threads number in tomcat properties and with the async approach you need to align tomcat properties and the pool that is used to run the async requests.

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Mar 12, 2020 · Eliran David

Hi Gopal, the maxThreads limits only the pool of tomact workers, not the java processes' threads. tomcat has more threads except the workers, like "Acceptor", "BlockPoller", etc. Also, the process has threads related to Garbage collector and monitoring (JMX). If you use IntelliJ for example, you can see the list of all threads in the Debugger window while your application is running.

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Dec 13, 2019 · Eliran David

Spring Service: Improving Processing Time Could Harm Service Scalability

Oct 12, 2019 · Eliran David

Thank you Ammar! That's was disturbing. Now make sense :)

Spring Service: Improving Processing Time Could Harm Service Scalability

Oct 12, 2019 · Eliran David

Thank you Robert. Currently, I understand the advantages of reactive approach only in theory but never had a full reactive service (and tested its performance in scale). It is my next subject for a blog post (to understand it better). In case you already know a post that includes a performance test (Spring Boot service with embedded tomcat) for reactive vs non-reactive, then a link will be helpful.

Spring Service: Improving Processing Time Could Harm Service Scalability

Oct 12, 2019 · Eliran David

Thanks Marc. Currently, I understand the advantages of reactive approach only in theory but never had a full reactive service (and tested its performance in scale). It is my next subject for a blog post (to understand it better). In case you already know a post that includes a performance test (Spring Boot service with embedded tomcat) for reactive vs non-reactive, then a link will be helpful.

Servlet 3.0 Async Support in Spring and Performance Misconceptions

Jul 26, 2018 · Eliran David

Thank you Tal.
Actually Callable and DeferredResult are completely different things except that they both triggers asynchronous request processing in Spring MVC when one of them is the return value of the controller. Callable is an interface that is part of java.util, and it is an improvement for the Runnable interface (should be implemented by any class whose instances are intended to be executed by a thread). Callable allows to return a value, while Runnable isn't. DeferredResult is a class designed by Spring to allow more options (that I will describe) for asynchronous request processing in SpringMVC, and this class just holds the result (as implied by its name) while your Callable implementation holds the async code. So it means you can use both in your controller, run your async code with Callable and set the result in DeferredResult, which will be the controller return value. So what do you get by using DeferredResult as the return value instead of Callable? DeferredResult has built-in callbacks like onError, onTimeout, and onCompletion. It makes error handling very easy.In addition, as it is just the result container, you can choose any thread (or thread pool) to run on your async code. With Callable, you don't have this choice.

User has been successfully modified

Failed to modify user

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: