12.07.2019 Views

NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You might find a scenario where you want multiple processes running in a single container. For that<br />

scenario, since there can be only one entry point per container, you could run a script within the<br />

container that launches as many programs as needed. For example, you can use Supervisor or a<br />

similar tool to take care of launching multiple processes inside a single container. However, even<br />

though you can find architectures that hold multiple processes per container, that approach it is not<br />

very common.<br />

Containerizing monolithic applications<br />

You might want to build a single, monolithically deployed web application or service and deploy it as<br />

a container. The application itself might not be internally monolithic, but structured as several<br />

libraries, components, or even layers (application layer, domain layer, data-access layer, etc.).<br />

Externally, however, it is a single container—a single process, a single web application, or a single<br />

service.<br />

To manage this model, you deploy a single container to represent the application. To scale up, you<br />

just add more copies with a load balancer in front. The simplicity comes from managing a single<br />

deployment in a single container or VM.<br />

Figure 4-1. Example of the architecture of a containerized monolithic application<br />

You can include multiple components, libraries, or internal layers in each container, as illustrated in<br />

Figure 4-1. However, this monolithic pattern might conflict with the container principle “a container<br />

does one thing, and does it in one process”, but might be ok <strong>for</strong> some cases.<br />

The downside of this approach becomes evident if the application grows, requiring it to scale. If the<br />

entire application can scale, it is not really a problem. However, in most cases, just a few parts of the<br />

application are the choke points that requiring scaling, while other components are used less.<br />

20 Architecting Container- and Microservice-Based <strong>Applications</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!