2021-10-08

Migrating Web Applications from Monolithic Structure to Microservices Architecture 阅读笔记

PDF path:/home/ljw/Nutstore Files/Nutstore/Anhui University/Microservice

Abstract

Monolithic structure problems

  • modules are tightly coupled 导致模块之间调用变得复杂
  • Monolithic structure中的每个模块不能单独的扩展,并且不同的模块不能使用不同的开发语言,配置环境等

problems of migrating

  • 由于复杂的逻辑和大量第三方库的依赖,难以对应用的特性进行准确的描述
  • 目前存在的研究大多基于应用的静态特征描述,缺乏对运行时动态特性的考虑

Solution

  • 结合静态分析和动态分析获取单体应用的静态结构和运行时的行为特征
  • 通过功能之间的耦合来评估依赖程度
  • 通过功能集群来实现遗留单体应用及其数据向微服务架构的迁移

Instruction

disadvantages

  • 当单体结构性能受到限制时,可能只是某一个componet出现问题,然而不能只单独修改这一个componet,各个componet不是Independent 。
  • 微服务架构将一个单体应用划分为多个independent的微服务,通过轻量级的http协议通信和交换数据
  • 静态分析:通过组合搜索和聚类算法提取微服务, 没有考虑应用运行时的行为特征,导致微服务划分的不合理。

contributions of this paper

提出了一种基于程序分析的的方法,先通过对应用程序源代码或二进制代码的静态分析,得到遗留应用程序中类的继承和依赖关系以及函数之间的调用。在进行动态分析,得到各类函数之间的调用关系等动态特征,作为静态数据特征的补充,提高静态模型的完整性和准确性。

  • 组合了静态分析和动态分析提取应用程序的特征
  • 基于应用行为模型,通过类和功能关联分析、应用领域模型和数据流分析,提出了一种基于应用功能关联聚类的微服务划分方法
  • 通过对不同分区结果的可扩展性和性能差异的实证研究,确定了影响遗留系统向微服务架构迁移的关键因素,提高了系统性能,增强了可扩展性等诸多预期优化效果。

Methodology

  • 单体应用特征分析:组合静态分析和动态分析获得应用的特征
  • 基于特征聚类分区:通过微服务的设计原则进行特征聚类,确定微服务候选人的几何
  • 使用相关的技术将从微服务候选人的集合中搭建微服务
    在这里插入图片描述

Legacy Application Analysis and Modeling

analysis

  • 通过对应用源码的静态分析可以获得类层次结构和函数功能之间的调用关系,建立模块,类,函数的graph
  • divide the function of closely linked to the same service, help to reduce due to the communication between the microservices time costs, also accord with the software development of the basic principles of high cohesion and loose coupling.
  • adopt the static interaction model, runtime dynamic interaction model, structure model, the developer’s contribution model, to describe the structure of the application characteristics

Static Interaction Model

  • the microservices candidate set extracted by searching the graph and clipping the graph
  • through correlation evaluation index and domain knowledge will be closely linked, and conforms to the call both domain knowledge together
  • use its abstract syntax tree , semantic feature ‘ S y n t a x M ‘ `{Syntax_M}` SyntaxM and static call graph ( ‘ C a l l G r a p h M ‘ `{CallGraph_M}` CallGraphM) 描述应用的特征 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cVtjfLSy-1633660609482)(uploads/19cd8b5ade44571894890acd15be489b/image.png)]
  • 类和函数的交互关系使用 ‘ R = G ( V , E ) U I ( i 1 . . . . i n ) ‘ `{R = G(V, E) U I({i_1}....{i_n})}` R=G(V,E)UI(i1....in),R代表类之间的交互关系,G标示图,V顶点表示函数,E边表示调用关系,I表示耦合程度,通过调用关系,频率等信息表示。

Application Dynamic Model

  • 若没有进行动态分析,函数之间的调用频率无法获得
  • 动态分析方法的代码覆盖率低,不能涵盖所有用户输入,导致应用程序的功能不完整
  • The dynamic scheduling frequency combined with the dependence obtained from static analysis to form the interactive characteristics of the application.
  • adopts the customer behavior model graph (CBMG) to represent the components interaction of the application and use the statistical data to calculate the transition probability
  • the dynamic method can infers the coupling degree of the class and functions from the interaction frequency
    在这里插入图片描述

Constraints of Microservices Construction

  • 根据服务能力和服务确定微服务的边界。
  • 基本原则:high cohesion and loose coupling
  1. reduce the interaction frequency of microservices
    based on the evaluation of coupling degree
  2. reduce message communication overhead in microservices
  3. the deployment and choreography of microservices should be as low as possible
  • 评估在应用程序中的类和方法结构之间的连接和跳跃概率,我们用转移概率来表示从节点a到节点b的跳转概率 P(b|a) 使用马尔可夫链模型来表示节点或函数之间的迁移特征
  • 静态 + 动态 get a complete application function of interaction matrix.
  • model building and Microservices evaluations and measurement 的细节见3.2.2

Migration Rules

  • 为了较少开发人员参与,提出了一个半自动化的迁移方法。建立一个评估模型。具体规则如下:
  1. Based on the importance of the business logic, divided the functions to general and key functions.
  2. 根据交互频率
  3. 根据函数之间的调用关系
  4. 根据函数之间的依赖关系

Application Characteristics Clustering

  • 采用k_means聚类方法对应用程序的行为特征和调用关系聚类,初次中心点由应用的交互行为特征决定。距离中心点的距离和两个函数相关性系数由以下公式确定:

在这里插入图片描述在这里插入图片描述

  • 聚类会产生多种结果,使用Jaccard相似系数来
    衡量两者的相似度。当相似度小于 δ = 0.35,用作不同的分区;否则,它被认为相同的分区。
    在这里插入图片描述
  • use SSE as the clustering objective function, ‘ c i ‘ `{c_i}` ci表示中心点,dist表示Euclidean distance
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qxKZohFF-1633660609492)(uploads/93afe7a6e34ff0f22a6f73b8b86a335c/image.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rUD7wUU4-1633660609494)(uploads/454823e0121dff526367e426b4318db8/image.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-UoG3oBx0-1633660609496)
(uploads/86189fa8e32ed8bafcb28e7ace421b87/image.png)][外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-MgFVv3rX-1633660609496)
(uploads/65e4504a488f80318afc8dca66073dd0/image.png)][外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JGcNDmZZ-1633660609499)

Data migration

  • 在微服务环境中,不合理的数据分区会导致微服务之间交互频繁,数据传输量增加,整体性能下降。
  • EasyAPM: 监控数据操作过程
  • 根据数据使用特征, 函数如何访问数据实体,应用程序的逻辑。将数据划分到相同的微服务
  • 现有的工作主要根据数据库实体的结构和应用来划分数据库实体的访问频率,没有结合函数访问数据的需求。
  • 本文通过追踪应用系统访问历史数据的记录获得函数访问数据的需求

Experiment

&esmp;evaluation: 比较微服务与单体架构的performance and scalability

experiment setup

  • choose four typical performance benchmark application, DayTrader, JPetstore, TPC-W and RUBiS
  • 为验证提出方法的有效性,选取了12个应用完成了微服务的迁移
  • 配置:used three Inspur blade server NX580. Each server configured with two Intel Xeon E5645 CPU, 16GB memory and installed Ubuntu 16.04.1 x64.

Comparison of Monolithic and Microservices

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-axIv6JZf-1633660609500)(uploads/29c767e7c79962c7af974708502ea4c9/image.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-QJwYxLuu-1633660609501)(uploads/6425feaa3cc3373d3aa0b6f55280687f/image.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-BUUUuz4b-1633660609502)(uploads/285df172e50552e9d708c008e7afeda6/image.png)]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值