可靠性:
由于采用远程调用的方式,任何一个节点、网络出现问题,都将使得服务调用失败,随着微服务数量的增多,潜在故障点也将增多。
也就是没有充分的保障机制,则单点故障会大量增加。
运维要求高:
系统监控、高可用性、自动化技术
分布式复杂性:
网络延迟、系统容错、分布式事务
部署依赖性强:
服务依赖、多版本问题
性能(服务间通讯成本高):
无状态性、进程间调用、跨网络调用
数据一致性:
分布式事务管理需要跨越多个节点来保证数据的瞬时一致性,因此比起传统的单体架构的事务,成本要高得多。另外,在分布式系统中,通常会考虑通过数据的最终一致性来解决数据瞬时一致带来的系统不可用。
重复开发:
微服务理念崇尚每个微服务作为一个产品看待,有自己的团队开发,甚至可以有自己完全不同的技术、框架,那么与其他微服务团队的技术共享就产生了矛盾,重复开发的工作即产生了。
1 2 3 4 5 6 7 8 9 | package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.6.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-core</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> |