system-design-primer/resources/noat.cards/Application layer.md

41 lines
2.5 KiB
Markdown
Raw Normal View History

2021-03-14 13:08:05 +03:00
+++
noatcards = True
isdraft = False
+++
2021-03-14 18:13:28 +03:00
# Application layer
2021-03-14 13:08:05 +03:00
2021-03-21 13:45:39 +03:00
## Application layer - Introduction
2021-03-14 13:08:05 +03:00
2021-03-21 13:45:39 +03:00
![](https://camo.githubusercontent.com/feeb549c5b6e94f65c613635f7166dc26e0c7de7/687474703a2f2f692e696d6775722e636f6d2f7942355359776d2e706e67)
2021-03-14 13:08:05 +03:00
2021-03-21 14:33:05 +03:00
[Source: Intro to architecting systems for scale](http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer)
2021-03-14 13:08:05 +03:00
Separating out the web layer from the application layer (also known as platform layer) allows you to scale and configure both layers independently. Adding a new API results in adding application servers without necessarily adding additional web servers.
2021-03-21 13:12:09 +03:00
The single responsibility principle advocates for small and autonomous services that work together. Small teams with small services can plan more aggressively for rapid growth.
2021-03-14 13:08:05 +03:00
2021-03-21 13:12:09 +03:00
Workers in the application layer also help enable [asynchronism](https://github.com/donnemartin/system-design-primer#asynchronism) .
2021-03-14 13:08:05 +03:00
2021-03-21 13:45:39 +03:00
## Microservices
2021-03-14 13:08:05 +03:00
2021-03-21 13:12:09 +03:00
Related to this discussion are [microservices](https://en.wikipedia.org/wiki/Microservices) , which can be described as a suite of independently deployable, small, modular services. Each service runs a unique process and communicates through a well-definied, lightweight mechanism to serve a business goal. [1](https://smartbear.com/learn/api-design/what-are-microservices)
2021-03-14 13:08:05 +03:00
Pinterest, for example, could have the following microservices: user profile, follower, feed, search, photo upload, etc.
2021-03-21 13:55:58 +03:00
## Service Discovery
2021-03-14 13:08:05 +03:00
2021-03-21 13:12:09 +03:00
Systems such as [Zookeeper](http://www.slideshare.net/sauravhaloi/introduction-to-apache-zookeeper) can help services find each other by keeping track of registered names, addresses, ports, etc.
2021-03-14 13:08:05 +03:00
2021-03-21 13:55:58 +03:00
## Disadvantage(s) : application layer
2021-03-14 13:08:05 +03:00
2021-03-14 18:13:28 +03:00
- Adding an application layer with loosely coupled services requires a different approach from an architectural, operations, and process viewpoint (vs a monolithic system) .
- Microservices can add complexity in terms of deployments and operations.
2021-03-14 13:08:05 +03:00
2021-03-21 13:55:58 +03:00
## Source(s) and further reading
2021-03-14 13:08:05 +03:00
2021-03-14 18:13:28 +03:00
- [Intro to architecting systems for scale](http://lethain.com/introduction-to-architecting-systems-for-scale)
- [Crack the system design interview](http://www.puncsky.com/blog/2016/02/14/crack-the-system-design-interview/)
- [Service oriented architecture](https://en.wikipedia.org/wiki/Service-oriented_architecture)
- [Introduction to Zookeeper](http://www.slideshare.net/sauravhaloi/introduction-to-apache-zookeeper)
- [Here's what you need to know about building microservices](https://cloudncode.wordpress.com/2016/07/22/msa-getting-started/)