Categories: 未分类

# Queue

First we know that the queue model is based on Poisson distribution. Here is three characteristics of Poisson distribution:

• The experiment consists of counting the number of events that will occur during a specific interval of time or in a specific distance, area, or volume.
• The probability that an event occurs in a given time, distance, area, or volume is the same.
• Each event is independent of all other events. For example, the number of people who arrive in the first hour is independent of the number who arrive in any other hour.

## Little’s Theorem

N = λT

N=average number of customers

λ=Average arrival rate

T=Average sojourn(stay) time of a customer

Apply the Little’s Theorem to the Network Delay environment

We should also add some notation:

ρ: the line’s utilization factor(we can see that $ρ=\frac{λ}{μ}$ later)

X: average transmission time

$ρ=λX$

now introduce the model:

Categories: 未分类

# Sidecar pattern

This is the content from chapter 2 in Designing Distributed Systems.

## 1. What is the sidecar pattern?

Usually, we deploy a new container along with the application container, instead of deploying the application container alone, for realizing some functions(proxy, monitor, etc.). We call this the sidecar pattern. It belongs to the single-node pattern.

## 2. What can sidecar pattern help us?

We can realize such functions with the sidecar pattern: proxy, monitoring, and synchronization as PaaS.

• Proxy

For example, we have a legacy backend application only support HTTP. Now if we want to use HTTPS, we can use the sidecar SSL proxy container to handle HTTPS requests and forward them to the old legacy service.

• Synchronization as PaaS

Check figures above, with the sidecar application, developers can easily update the configure file or repository codes.

• Monitoring

We can deploy a sidecar container with the same IPC namespace as the original application container. We then collect the resource usage from the sidecar container and expose a port from the sidecar container for metrics collection.

## Designing Sidecars for Modularity and Reusability

We follow these three rules to build our sidecars: