简体   繁体   English

将一个大的整体应用程序拆分为两个应用程序有什么好处?

[英]What are the benefits of splitting a big monolithic application into 2 applications?

We currently have a big monolithic J2EE application (weblogic / DB2). 当前,我们有一个大型的单片J2EE应用程序(weblogic / DB2)。 It is a typical OLTP application. 这是典型的OLTP应用程序。 We are considering to split this application into 2 applications where each application has its own database which is not directly accessible by the other application. 我们正在考虑将该应用程序拆分为2个应用程序,其中每个应用程序都有自己的数据库,其他应用程序无法直接访问该数据库。 This also means that each application need to expose an interface for the functionality that is needed by the other application. 这也意味着每个应用程序都需要公开其他应用程序所需功能的接口。

So what are potentially the major benefits of splitting such an existing application into 2 applications ? 那么,将这样一个现有应用程序分为2个应用程序的潜在主要好处是什么?

Most of applications using 10% of code during 90% of the time. 大多数应用程序在90%的时间内使用10%的代码。

The core idea of the micro-services which is modern SOA. 微服务的核心思想是现代SOA。 You are able to elastically scale the critical part of your application in the micro-service specific special cloud. 您可以在微服务特定的特殊云中灵活扩展应用程序的关键部分。 Cloud is an elastic cluster, where each node is a virtual server (XEN or VMware etc.). 云是一个弹性集群,其中每个节点都是一个虚拟服务器(XEN或VMware等)。 Cloud can extend or shrink nodes count automatically according to the load factor, without manual attention. 云可以根据负载因子自动扩展或收缩节点数,而无需人工关注。

With the classic monolithic applications, you need to scale a whole monolithic application. 对于经典的单片应用程序,您需要扩展整个单片应用程序。 Usually such application use a large amount of RAM, as well as require strong hardware or strong and expensive virtual server. 通常,此类应用程序使用大量RAM,并且需要强大的硬件或强大而昂贵的虚拟服务器。 Another disadvantage of monolithic - if you need to release a new business feature, release cycle will be really long, since you've done a modification to the huge and complicated code-base with a code entropy. 整体式的另一个缺点-如果您需要发布新的业务功能,则发布周期会非常长,因为您已经使用代码熵对庞大而复杂的代码库进行了修改。 It will require time/budget expensive regression testing. 这将需要时间/预算昂贵的回归测试。 But you have a benefit - different application parts (subsystems and modules) can be integrated much easier comparative to the SOA approach, off cause if you have good application design. 但是您有一个好处-与SOA方法相比,可以轻松集成不同的应用程序部分(子系统和模块),如果您具有良好的应用程序设计,这是没有原因的。

On another side - you can split your application logic to the set of small applications, such application called a micro-service. 另一方面,您可以将应用程序逻辑拆分为一组小型应用程序,例如称为微服务的应用程序。 For instance you have one micro-service responsible for UI only - ie only Spring MVC with Angluar.js, another micro-service for business logic and persistence, and one more micro-service for obtaining data from social networks. 例如,您有一个仅负责UI的微服务-即只有带有Angluar.js的Spring MVC,另一个用于业务逻辑和持久性的微服务,以及另一个用于从社交网络获取数据的微服务。 All those services are interconnected with each other using some web-services usually RestFull, but can be SOAP or something like Google Protocol Buffers RPC etc. So now you are able to auto-scale only UI micro-service, which is expected to be performance critical, without touching business logic and social network micro-services. 所有这些服务都使用通常为RestFull的某些Web服务彼此互连,但可以是SOAP或类似Google Protocol Buffers RPC之类的东西。因此,现在您只能自动缩放UI微服务,这有望实现性能关键,而无需触及业务逻辑和社交网络微服务。 And you are able to update UI micro-service even once a weak, since UI only testing is not so expensive like business logic testing. 而且,即使只有一个弱点,您也能够更新UI微服务,因为仅UI测试并不像业务逻辑测试那样昂贵。 But there is a disadvantage - cluster structure became more complicated, and require stronger team to maintain it (usually automate with some Chef or Docker based scripts). 但是有一个缺点-集群结构变得更加复杂,并且需要更强大的团队来维护它(通常使用某些基于Chef或Docker的脚本来实现自动化)。 It is also hardly to implement subsystem integrations and you need to think about your system design more carefully. 同样也很难实现子系统集成,并且您需要更仔细地考虑系统设计。

So, if you have a huge and complicated system which is hi-loaded (like Amazon.com, Ebay, Facebook or stackoverflow). 因此,如果您有一个庞大且复杂的系统,需要高负载(例如Amazon.com,Ebay,Facebook或stackoverflow)。 SOA approach gives you an opportunity to save some money on infrastructure and hardware. SOA方法使您有机会在基础架构和硬件上节省一些钱。 But it will be more expensive in development. 但是它的开发成本会更高。 And if you system is very simple, ie internet cafe site with a few pages - monolithic approach is preferred. 如果您的系统非常简单,即网吧站点只有几页,则首选整体方法。

If scalability isn't your concern, then I'd be pointing at the following benefits: 如果您不关心可伸缩性,那么我将指出以下好处:

  • Increased change velocity - shorter time for a feature to get from the idea phase to production (lower complexity for developers) 增加的变更速度-缩短功能从构思阶段到生产的时间(降低开发人员的复杂性)
  • Lower cost of testing (smaller scope to test) 较低的测试成本(较小的测试范围)
  • Improved quality (again, smaller scope to test) 质量提高(再次,更小的测试范围)

We can't weigh advantages and disadvantages without looking what that application is all about, what are business rules, how you are dividing application and how two applications share business rules. 我们无法权衡利弊,而不必查看该应用程序的全部内容,什么是业务规则,如何划分应用程序以及两个应用程序如何共享业务规则。 Dividing an application into two application is not just diving java classes into two groups. 将一个应用程序分为两个应用程序不只是将Java类分为两个组。 It require depth analysis from different perspective. 它需要从不同角度进行深度分析。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM