spring - boundedElastic() 与 parallel() 调度程序之间的区别

标签 spring reactive-programming scheduler

我是 Project reactor 的新手,我正在尝试了解 boundedElastic() 与 parallel() 调度程序之间的区别。文档 ( https://projectreactor.io/docs/core/release/api/ ) 说 boundedElastic() 用于阻塞任务,parallel() 用于非阻塞任务。为什么 Project reactor 需要解决阻塞场景,因为它们本质上是非阻塞的。有人可以帮我解决一些有关 boundedElastic() 与 parallel() 调度程序的实时用例吗
?

最佳答案

并行风格由 N 个工作人员(根据 N 个 cpu)支持,每个工作人员都基于 ScheduledExecutorService。如果您向它提交 N 个长期任务,则无法执行更多工作,因此对短期任务具有亲和力。
弹性风格也得到了基于 ScheduledExecutorService 的工作人员的支持,除了它按需创建这些工作人员并将它们池化。
BoundedElastic 与弹性相同,不同之处在于您可以限制总数。线程。
https://spring.io/blog/2019/12/13/flight-of-the-flux-3-hopping-threads-and-schedulers

关于spring - boundedElastic() 与 parallel() 调度程序之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61304762/

相关文章:

linux - 为什么 Linux 的调度程序将两个线程放在具有超线程的处理器上的同一个物理内核上?

python - Airflow :将 {{ ds }} 作为参数传递给 PostgresOperator

spring - Scala 与 Spring : Constructor autowiring

Java:无法在 Spring MVC 中解析带有名称的 View

retrofit - 如何使用改造和 rxjava 取消任务

java - 获取 Observable 的最新值并立即发出

java - 在Spring中按顺序实例化bean?

java - Java EE部署中的Spring类加载机制

stream - Apache Kafka Streams 将 KTables 物化为主题似乎很慢

hadoop - ACL在YARN(CDH5)的Capacity Scheduler中不起作用