笔记:Microservices for Java Developers

    xiaoxiao2022-05-13  237

    从InfoQ上免费下载了一本Microservices for Java Developers,这两天把前面部分稍微过了一下,感觉写的挺明白的。

    Microservice的定义Microservice architecture (MSA) is an approach to building softwaresystems that decomposes business domain models into smaller,consistent, bounded-contexts implemented by services. These servicesare isolated and autonomous yet communicate to provide somepiece of business functionality. Microservices are typically implementedand operated by small teams with enough autonomy thateach team and service can change its internal implementationdetails (including replacing it outright!) with minimal impact acrossthe rest of the system.

    Microservice的特点Teams communicate through promises, which are a way a servicecan publish intentions to other components or systems that maywish to use the service. They specify these promises with interfacesof their services and via wikis that document their services. If thereisn’t enough documentation, or the API isn’t clear enough, the serviceprovider hasn’t done his job. A little more on promises andpromise theory in the next section.

    Each team would be responsible for designing the service, pickingthe right technology for the problem set, and deploying, managingand waking up at 2 a.m. for any issues. For example, at Amazon,there is a single team that owns the tax-calculation functionality thatgets called during checkout. The models within this service (Item,Address, Tax, etc.) are all understood to mean “within the context ofcalculating taxes” for a checkout; there is no confusion about theseobjects (e.g., is the item a return item or a checkout item?). Theteam that owns the tax-calculation service designs, develops, andoperates this service. Amazon has the luxury of a mature set of selfservicetools to automate a lot of the build/deploy/operate steps, butwe’ll come back to that.

    Microservice解决的问题With microservices, we can scope the boundaries of a service, whichhelps us:

    Understand what the service is doing without being tangled into

    other concerns in a larger application

    Quickly build the service locally Pick the right technology for the problem (lots of writes? lots of

    queries? low latency? bursty?)

    Test the service Build/deploy/release at a cadence necessary for the business,

    which may be independent of other services

    Identify and horizontally scale parts of the architecture where

    needed

    Improve resiliency of the system as a whole

    Microservices help solve the “how do we decouple our services andteams to move quickly at scale?” problem. It allows teams to focuson providing the service and making changes when necessary andto do so without costly synchronization points. Here are things youwon’t hear once you’ve adopted microservices:

    Jira tickets Unnecessary meetings Shared libraries Enterprise-wide canonical models

    Microservice是否适合你? (Microsercie带来很多好处,不过也都是有代价的) Is microservice architecture right for you? Microservices have a lotof benefits, but they come with their own set of drawbacks. You canthink of microservices as an optimization for problems that requirethe ability to change things quickly at scale but with a price. It’s not

    It can be more resource intensive. You may end up withlooks like duplication. Operational complexity is a lot higher. It

    becomes very difficult to understand the system holistically. Itbecomes significantly harder to debug problems. In some areas youmay have to relax the notion of transaction. Teams may not havebeen designed to work like this.

    并不是所有的业务都适合MicroserviceNot every part of the business has to be able to change on a dime. Alot of customer-facing applications do. Backend systems may not.But as those two worlds start to blend together we may see the forcesthat justify microservice architectures push to other parts of the system.

    书不长一百多页,后面具体的配置、编码的部分还没看,前面看了感觉写的还可以。有需要的可以去InfoQ下载。https://www.infoq.com/vendorcontent/show.action?vcr=4339&utm_source=infoq&utm_medium=VCR&utm_campaign=vcr_homePage_click&utm_content=bottom

    相关资源:Microservices for Java Developers 无水印pdf

    最新回复(0)