{"id":"application-layer","title":"Application layer","sections":[{"id":"overview","title":"Overview","html":"<p class=\"figure\">\n  <img src=\"/repo/images/yB5SYwm.png\" loading=\"lazy\" decoding=\"async\" alt=\"Diagram\">\n  <br>\n  <i><a href=\"http://lethain.com/introduction-to-architecting-systems-for-scale/#platform_layer\" target=\"_blank\" rel=\"noopener noreferrer\">Source: Intro to architecting systems for scale</a></i>\n</p>\n<p>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.  The <strong>single responsibility principle</strong> advocates for small and autonomous services that work together.  Small teams with small services can plan more aggressively for rapid growth.</p>\n<p>Workers in the application layer also help enable <a href=\"/learn/asynchronism\">asynchronism</a>.</p>","headings":[]},{"id":"microservices","title":"Microservices","html":"<h3 id=\"microservices\">Microservices</h3>\n<p>Related to this discussion are <a href=\"https://en.wikipedia.org/wiki/Microservices\" target=\"_blank\" rel=\"noopener noreferrer\">microservices</a>, which can be described as a suite of independently deployable, small, modular services.  Each service runs a unique process and communicates through a well-defined, lightweight mechanism to serve a business goal. <sup>&#x3C;a href=<a href=\"https://smartbear.com/learn/api-design/what-are-microservices%3E1\" target=\"_blank\" rel=\"noopener noreferrer\">https://smartbear.com/learn/api-design/what-are-microservices>1</a></sup></p>\n<p>Pinterest, for example, could have the following microservices: user profile, follower, feed, search, photo upload, etc.</p>","headings":[{"id":"microservices","title":"Microservices","depth":3}]},{"id":"service-discovery","title":"Service Discovery","html":"<h3 id=\"service-discovery\">Service Discovery</h3>\n<p>Systems such as <a href=\"https://www.consul.io/docs/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">Consul</a>, <a href=\"https://coreos.com/etcd/docs/latest\" target=\"_blank\" rel=\"noopener noreferrer\">Etcd</a>, and <a href=\"http://www.slideshare.net/sauravhaloi/introduction-to-apache-zookeeper\" target=\"_blank\" rel=\"noopener noreferrer\">Zookeeper</a> can help services find each other by keeping track of registered names, addresses, and ports.  <a href=\"https://www.consul.io/intro/getting-started/checks.html\" target=\"_blank\" rel=\"noopener noreferrer\">Health checks</a> help verify service integrity and are often done using an <a href=\"/learn/communication#hypertext-transfer-protocol-http\">HTTP</a> endpoint.  Both Consul and Etcd have a built in <a href=\"/learn/database#key-value-store\">key-value store</a> that can be useful for storing config values and other shared data.</p>\n<h3 id=\"disadvantages-application-layer\">Disadvantage(s): application layer</h3>\n<ul>\n<li>Adding an application layer with loosely coupled services requires a different approach from an architectural, operations, and process viewpoint (vs a monolithic system).</li>\n<li>Microservices can add complexity in terms of deployments and operations.</li>\n</ul>\n<h3 id=\"sources-and-further-reading-9\">Source(s) and further reading</h3>\n<ul>\n<li><a href=\"http://lethain.com/introduction-to-architecting-systems-for-scale\" target=\"_blank\" rel=\"noopener noreferrer\">Intro to architecting systems for scale</a></li>\n<li><a href=\"http://www.puncsky.com/blog/2016-02-13-crack-the-system-design-interview\" target=\"_blank\" rel=\"noopener noreferrer\">Crack the system design interview</a></li>\n<li><a href=\"https://en.wikipedia.org/wiki/Service-oriented_architecture\" target=\"_blank\" rel=\"noopener noreferrer\">Service oriented architecture</a></li>\n<li><a href=\"http://www.slideshare.net/sauravhaloi/introduction-to-apache-zookeeper\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction to Zookeeper</a></li>\n<li><a href=\"https://cloudncode.wordpress.com/2016/07/22/msa-getting-started/\" target=\"_blank\" rel=\"noopener noreferrer\">Here's what you need to know about building microservices</a></li>\n</ul>","headings":[{"id":"service-discovery","title":"Service Discovery","depth":3},{"id":"disadvantages-application-layer","title":"Disadvantage(s): application layer","depth":3},{"id":"sources-and-further-reading-9","title":"Source(s) and further reading","depth":3}]}],"sourceFiles":[]}