简体   繁体   中英

What are advantages of Vert.x comparing to threadPool?

On web scene, I use SpringBoot handle requests, for each request, main thread send several requests to other servers to acquire data (this step use treadPool to async), finally main thread "get" all data and return.

So I wonder what are advantages of Vert.x on this scene? Both of them use multi threads to async tasks, will performance be better if I replace the threadPool with vert.x?

Is it not the same, Vert.x does not create a new Thread for each request. Vert.x has something called Event loop which are managed using few Java threads.

The number of threads used by Vert.x increases as the number of Verticles that you deploy increases, but it will still be very lower in Count.

Also the code in Vert.x is Reactive is executed based on events, so if you are waiting for a event (for example Http Response) you code will be invoked when there is a response available and there is not thread blocked for response.

Check this for more information: https://alexey-soshin.medium.com/understanding-vert-x-event-loop-46373115fb3e

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM