响应式编程

type
status
date
slug
summary
tags
category
icon
password

what ?

  1. 响应式宣言
  1. 一个基于面向数据流和传播变化的异步编程模型
  1. 和 Java 8 Streams 以及 Iterable-Iterator 比较
      • reactive 是 推模型, events 来了,推到 subscriber
      • Java 8 Streams 以及 Iterable-Iterator 是 拉模型
  1. 背压 流量控制: 告诉上游自己需要多少数据
      • 如果不能 slow down, 只能 buffer , drop or fail
      • 在数据流从上游生产者向下游消费者传输的过程中,上游生产速度大于下游消费速度,导致下游的 Buffer 溢出,这种现象就叫做 Backpressure 出现。
  1. 规范标准,就是一个接口
      • publisher
      • subscriber
      • subscription
      • processor
  1. 实现
  • webflux
    • 参考 webflux 文章
  • Project Reactor 参考 Project Reactor 文章
  • RxJava
    • 较老
      • main 里面同步
      • 加 Scheduler,异步
  • 响应式数据库
    • 底层连接协议如何与数据库建立通讯
    • springJDBC -> JDBC 规范 -> mysql jdbc Driver -> mysql
    • R2DBC Drivers
      • All terminal methods always return a Publisher type that represents the desired operation. The actual statements are sent to the database upon subscription.

how

总结来说,实际上就是:“异步编程,事件驱动”
  • 消息驱动
  • 同步与异步
    • callable
    • BiFunction
    • 同步:哪个线程产生就在哪个线程消费
  • 命令式编程与响应式编程
    • 函数式编程 Functional Programming
      • “what to solve”
      • 命令式编程
        • “how to solve”
      • 基于 lamda calculus
      • 编程范式,编程程序的方法论
  • 观察者模式
  • Tomcat 的 NIO 异步网络 IO
  • 服务器推技术
  • Servlet 3.0 与 3.1

why ?

一句话:提高性能
  • 使用更多的线程和硬件资源来提高并行度
  • 提高现有资源的使用效率
Prev
Webflux 介绍
Next
智能笔记本管理系统‌‌项目设计文档‌‌版本:1.0‌‌
Loading...