Nginx
- Nginx is an event driven, high throughput web server. It can be used as a Load balancer.
- It supports the following features,
- Layer 4 & Layer 7 load balancer
- TLS termination
- Rate limiting through leaky bucket algorithm
- Static content serving through it’s cache
- Reverse proxy
3. It supports rolling update of configuration without dropping any connections or interruption of service. The same goes for upgrading nginx as well.
4. It supports the following protocols,
- HTTP(S)
- TCP (TLS)
- POP3
- SMTP
- IMAP
5. It has the following types of processes,
- Master (Launches various processes, upgrades configuration, binding to ports)
- Child (or worker -- It does actual traffic handling)
- Cache Loader (at startup, It loads the content from disk to in memory cache)
- Cache Manager (It periodically prunes the cache to keep it to a limit)
6. Typically, one worker per core is assigned to avoid context switches. Each worker is a single threaded process handles thousands of connections.
7. In traditional web servers, each connection is mapped to a thread or process. It’s actually an imbalanced mapping. Because connection(represented by file descriptor and small amount of memory) is mapped to a heavy weight thread or process. Hence, web servers quickly hits the limit of compute resources. Nginx takes a different approach here. It allocates single threaded process to handle thousands of connection in event driven way (or non blocking way). This architectural change makes it so powerful.