WEB网关系列01-什么是WEB网关

WEB网关系列-什么是WEB网关 gateway,我们一般都称为网关。翻译意思有网关;(通往其他地区的)门户;方法;途径;出入口;手段;门道;大门口。 现实生活中的网关有比如,高速公路的收费口、城门入口、景区或者游乐园的入口等。它们都充当了入口的功能,还有检测功能等等。 而在web中的网关,它充当的是流量的入口,一般来说当有流量进入到web程序,它的第一层便是经过网关,然后经网关代理到准确的服务地址上, 同时,对应的服务产生响应,然后网关把响应反馈回去。那么网关就充当了,流量转发的角色, 个人觉得它是一个网关最核心的功能。 在流量转发这个场景下,可以衍生出无数种组合出来。因为,我们的web应用程序存在的方式是多种多样的,比如在线购物网站、wps、视频网站等等。当然市面上常用的就是基于http协议的web服务, 还有tcp、udp、websocket等。 除了流量转发,网关还需要限制恶意的请求过来,仅正确的用户、正确的请求才可以通过,也就是网关需要提供鉴权的功能。 网关还有就是限制请求流量的作用,举个例子来说,当一台计算机器它的瞬时处理能力只有1千个请求,那瞬时有2千个请求过来,网关处理不过来的话, 限流就在这种场景下面产生了。

Reactor Pattern

Intent 意图 The Reactor design pattern handles service requests that are delivered concurrently to an application by one or more clients. 反应器设计模式处理由一个或多个客户端并发传递到应用程序的服务请求, The application can register specific handlers for processing which are called by reactor on specific events. 应用程序可以注册用于处理的特定处理程序,这些处理程序由反应器在特定事件上调用 Dispatching of event handlers is performed by an initiation dispatcher, which manages the registered event handlers. 事件处理程序的分派由启动分派程序执行,该程序管理已注册的事件处理程序 Demultiplexing of service requests is performed by a synchronous event demultiplexer. 服务请求的解复用由同步事件解复用器执行 Class diagram 类图 Applicability 应用 Use Reactor pattern when 以下场景可以使用Reactor 模式

Scalable in java 翻译

目录 Scalable network services 可扩展的网络服务 Event-driven processing 事件驱动处理 Reactor pattern Reactor 模式 Basic version 基本版本 Multithreaded versions 多线程版本 Other variants 其他变体 Walkthrough of java.nio nonblocking IO APIs 预编排java.nio nonblocking IO APIs Network Services 网络服务 Web services, Distributed Objects, etc 网络服务,分布式对象,等等。 Most have same basic structure: 大多数都有以下的基本结构 Read request 读请求 Decode request 解码请求 Process service 处理服务 Encode reply 编码响应 Send reply 发送响应 But differ in nature and cost of each step 当然在实际应用中每一步的运行效率都是不同的,例如其中可能涉及到xml解析、文件传输、web页面的加载、计算服务等不同功能 XML parsing, File transfer, Web page generation, computational services, … Classic Service Designs 传统的服务设计 Each handler may be started in its own thread 在一般的网络服务当中都会为每一个连接的处理开启一个新的线程,我们可以看下大致的示意图: public class Test { private static Integer PORT = 8080; public static void main(String[] args) { Server server = new Server(); server.

什么是metadata

什么是metadata,带例子 metadata is simply data about data,It means it is a description and context of the data. It helps to organize, find and understand data. Here are a few real world examples of metadata. 元数据是数据的数据,这意味着他是数据的描述和上下文。它帮助我们了解和认识数据。下面有一些真是的关于元数据的例子。 Typical metadata Those are some typical metadata elements: Title and description, Tags and categories, Who created and when, Who last modified and when, Who can access or update. A photo Every time you take a photo with today’s cameras a bunch of metadata is gathered and saved with it

常用web记录

常用的网站记录 在线markdown docker国内镜像加速 另一个maven仓库 java全栈知识体系 jdk版本-爪哇我话你知 代码随想录-算法 labuladong 的算法小抄 Data Structure Visualizations 股票自动交易助手 excalidraw v2ex 免费图床 Redis命令集 在线搜索代码网站 Doug Lea’s Home Page 编程之路 ubuntu微信

常用命令记录

常用命令记录 通用命令 -- 查询系统超过100M的文件 sudo find / -type f -size +100M -- 查找某某文件 sudo find / -name *.java ubuntu常用命令 -- 安装jdk sudo apt install openjdk-8-jdk -- 卸载jdk sudo apt purge openjdk-8-jdk -- 切换java版本 sudo update-alternatives --config java