简体   繁体   English

微服务和网络服务有什么区别?

[英]What is the difference between microservices and webservices?

The closest I got to finding the actual difference is this article .我最接近发现实际差异的是这篇文章

But I didn't understand what would make me choose one over the other and if microservices can also use a REST API and communicate via http.但我不明白是什么让我选择一个而不是另一个,如果微服务也可以使用 REST API 并通过 http 进行通信。

I mainly didn't understand what a microservice is and if it can come instead of a webservice, other than the purpose of主要是不明白微服务是什么,能不能代替webservice来,除了目的

breaking large software applications into loosely coupled modules将大型软件应用程序分解为松散耦合的模块

A microservice is a software architecture, which can be implemented with webservices.微服务是一种软件架构,可以通过网络服务来实现。

A webservice is just a technology (one of many) for providing services over "web" or HTTP.一个Web服务仅仅是在“网络”或HTTP提供服务的技术(许多之一)。

I got simple answer here that says : Microservices is a new software architecture.我在这里得到了一个简单的答案:微服务是一种新的软件架构。 It is based on web services.它基于网络服务。 But it can be any service implemented as an independent feature that has its own database and can be deployed independently.但它可以是任何作为独立功能实现的服务,它拥有自己的数据库并且可以独立部署。

Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually.微服务是一种架构,其中系统的所有组件都放入单独的组件中,这些组件可以单独构建、部署和扩展。

The main point is: a web service is (as the name announces) something that you would expect to "deal" with HTTP - in other words it does something in the context of the world wide web .要点是: Web 服务(正如名称所宣布的)是您期望“处理”HTTP 的东西——换句话说,它在万维网的上下文中做一些事情。

Whereas a microservice is not subject to the WWW context.而微服务不受 WWW 上下文的影响。 At its core a microservice is supposed to provide one specific service - but there is no restriction to the http protocol for example.就其核心而言,微服务应该提供一项特定的服务 - 但例如对 http 协议没有限制。

Often a microservice implements a restful "web service" - but it doesn't have to be that way!微服务通常会实现一个宁静的“Web 服务”——但它不一定是那样的!

Beyond that, microservices are often meant as counter model to a huge monolithic application that serves many different kind of requests.除此之外,微服务通常意味着作为一个巨大的单体应用程序的反模型,该应用程序为许多不同类型的请求提供服务。

Microservices are the extension of web services.微服务是 Web 服务的扩展。

  • Web services are typically vertical in nature(Provider-Consumer communication) whereas microservices are horizontal in nature Web 服务本质上通常是垂直的(提供者-消费者通信),而微服务本质上是水平的
  • Microservices are seen as architecture due to the following.由于以下原因,微服务被视为架构。
  • microservices have belonged to one specific application.微服务属于一种特定的应用程序。
  • microservices are addressing specific concern so that can be said as lightweight.微服务正在解决特定问题,因此可以说是轻量级的。
  • Changes are isolated in nature because the change in one microservice doesn't affect other (Ex. Changes done in login microservice does not affect the payment microservice)更改本质上是隔离的,因为一个微服务的更改不会影响其他微服务(例如,登录微服务中所做的更改不会影响支付微服务)
  • Scaling individual microservices are easy.扩展单个微服务很容易。
  • Microservice usually has its own database.微服务通常有自己的数据库。

Microservices : -微服务:-

Microservice is a software architecture that can be used alongside web services.微服务是一种可以与 Web 服务一起使用的软件架构。 This method involves the splitting of large software applications into decoupled modules where microservices run unique processes and communicate through APIs.这种方法涉及将大型软件应用程序拆分为解耦模块,其中微服务运行独特的进程并通过 API 进行通信。 Its development can be through the use of either messaging, event-driven APIs, or using non-HTTP backed RPC mechanisms.它的开发可以通过使用消息传递、事件驱动的 API 或使用非 HTTP 支持的 RPC 机制。

Microservices architecture saves the day when large applications fail or are down.当大型应用程序出现故障或停机时,微服务架构可以挽救这一天。 If a particular service fails in communication, the overall application cannot be affected by the failure of a single module.如果某个特定服务在通信中出现故障,则整个应用程序不会受到单个模块故障的影响。 The combination of microservices in Java, C#, Python, and mobile software development languages is possible. Java、C#、Python 和移动软件开发语言的微服务组合是可能的。 It can be independently deployed in service models for a business domain.它可以独立部署在业务领域的服务模型中。 在此处输入图片说明

Web Services :-网络服务:-

A web service is just one of several technologies that can provide services over “web” or HTTP. Web 服务只是可以通过“Web”或 HTTP 提供服务的几种技术之一。 As a specific type of service-oriented architecture (SOA), web services represent a web application's functionality.作为一种特定类型的面向服务的体系结构 (SOA),Web 服务代表 Web 应用程序的功能。

It defines a mechanisms interaction between an API and the main code by using standard HTTP protocol and universal formats of data representation such as XML, JSON, and so on.它通过使用标准的 HTTP 协议和数据表示的通用格式(如 XML、JSON 等)定义了 API 和主代码之间的交互机制。 This allows software applications developed by different technologies to communicate with each other.这允许由不同技术开发的软件应用程序相互通信。

Web services are not involved with frontend development. Web 服务不涉及前端开发。 They are not connected to any development languages or user device software platforms.它们不连接到任何开发语言或用户设备软件平台。 The combination of different web services into a single one is also possible if written in different languages and for separate operating systems, just like in microservices.如果用不同的语言和不同的操作系统编写,也可以将不同的 Web 服务组合成一个单一的服务,就像在微服务中一样。

Microservice is a subset of web services .微服务是 web 服务的一个子集 Also used to name Architectures like "Architecture based on microservices"也用于命名架构,例如“基于微服务的架构”

Microservice is an artifact , not an architecture.微服务是一个神器,而不是一个架构。 Several world class companies know that几家世界class公司都知道

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb-shared.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb-shared.html

在此处输入图像描述

Before the microservice artifact , we had the classic web service or rest api. Even before this we had the Soap web services with XML.在微服务神器之前,我们有经典的 web 服务或 rest api。甚至在此之前我们有 Soap web 服务和 XML。

So, as a summary when someone talk about microservice , he means a subset of web service with some characteristics that differentiate it from classic web services or rest api .因此,作为总结,当有人谈论微服务时,他指的是 web 服务的一个子集,具有一些区别于经典 web 服务或 rest api 的特征

One main characteristic is a unique database or Database per Service一个主要特征是每个服务一个唯一的数据库或数据库

Here another characteristics from the goods like AWS.这里的另一个特点来自于 AWS 之类的商品。 Some of them apply to rest apis or soap services.其中一些适用于 rest api 或 soap 服务。 I will mark with bold some very specific for microservices.我将用粗体标记一些非常具体的微服务。

https://aws.amazon.com/microservices/ https://aws.amazon.com/microservices/

  • Agility敏捷
  • Flexible Scaling灵活缩放
  • Easy Deployment易于部署
  • Technological Freedom技术自由
  • Reusable Code可重用代码
  • Resilience弹力

https://microservices.io/ https://microservices.io/

  • Highly maintainable and testable高度可维护和可测试
  • Loosely coupled松耦合
  • Independently deployable可独立部署
  • Organized around business capabilities围绕业务能力组织
  • Owned by a small team由一个小团队拥有

https://www.baeldung.com/cs/microservices-db-design https://www.baeldung.com/cs/microservices-db-design

  • Database per Service每个服务的数据库
  • CQRS CQRS

https://learn.microsoft.com/en-us/azure/architecture/microservices/design/data-considerations https://learn.microsoft.com/en-us/azure/architecture/microservices/design/data-considerations

在此处输入图像描述

Microservice is a piece of autonomous application that performs for a larger application architecture.服务是为更大的应用程序架构执行的自治应用程序。

Web service is an approach to make the application available to other applications by web ui. Web服务是一种通过web ui使应用程序对其他应用程序可用的方法。

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

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