Skip to main content

Posts

Recent posts

Zero-Downtime Docker Deployments

Building Zero-Downtime Application Deployments using Docker & Nginx In production web applications, restarting a single container during code updates causes brief connection drops (502 Bad Gateway errors). Implementing a Blue-Green Deployment strategy allows you to launch updated application containers alongside active ones and switch traffic seamlessly with zero downtime. 1. Blue-Green Container Architecture Instead of overwriting a live container, we run two identical container ports: Blue Container: Active container receiving user traffic on port 8001 . Green Container: Staging container running updated code on port 8002 . 2. Setting Up Nginx Upstream Switching Configure Nginx to proxy requests to an active upstream configuration block in /etc/nginx/conf.d/app.conf : upstream app_backend { # Dynamically toggled via automation script between 8001 and 8002 server 127.0.0.1:8001; } server { listen 80; server_name app.yourdomain.com; ...

Optimizing Redis Infrastructure

Optimizing Redis Server Performance and Kernel Tuning on Linux Redis is an essential component in modern cloud architectures, acting as an in-memory database, cache layer, and message broker. However, running Redis with default out-of-the-box settings on high-traffic Linux hosts can lead to latency spikes and memory allocation failures. 1. Tuning Linux Kernel Memory Parameters When Redis writes snapshot dumps (RDB) to disk, it forks background child processes. If the Linux kernel lacks sufficient virtual memory headroom, forks fail. Fix this by setting memory overcommit rules in /etc/sysctl.conf : # Open sysctl config sudo nano /etc/sysctl.conf # Add the following kernel performance parameters: vm.overcommit_memory = 1 net.core.somaxconn = 65535 # Apply changes live without rebooting sudo sysctl -p 2. Disabling Transparent Huge Pages (THP) Transparent Huge Pages degrade Redis latency and increase memory usage significantly. Disable THP permanently by creating a system...

Production Log Management with

Production Log Management on Linux: Mastering logrotate for High-Uptime Servers Unmanaged log growth is one of the most common causes of unexpected production outages. When application or web server logs fill up host disk partitions, database transactions fail, services crash, and systems become un-writeable. Linux provides a built-in utility called logrotate to automatically compress, rotate, and archive old log files. 1. Understanding logrotate Structure System logrotate configurations are split between two main locations: /etc/logrotate.conf — Global baseline configurations. /etc/logrotate.d/ — Service-specific configuration files (e.g., Nginx, Docker, custom apps). 2. Creating a Custom Application Log Rule Create a rule file for a custom production web service at /etc/logrotate.d/jam-app : /var/log/jam-app/*.log { daily missingok rotate 14 compress delaycompress notifempty create 0640 www-data www-data sharedscripts ...

Securing Local LLM Endpoints

Securing Local LLM Endpoints: Reverse Proxying vLLM with Nginx and Let's Encrypt SSL When serving Large Language Models using frameworks like vLLM or Ollama, the default HTTP server exposes unencrypted API endpoints on port 8000 or 11434 . Exposing raw model endpoints directly to the open internet without TLS encryption or authentication creates severe security risks. In this guide, we will configure an Nginx Reverse Proxy with Certbot SSL to secure our vLLM endpoint behind HTTPS with rate-limiting and access protection. 1. Installing Nginx and Certbot on Ubuntu Start by updating system packages and installing Nginx along with Certbot for SSL management: sudo apt update && sudo apt install -y nginx certbot python3-certbot-nginx 2. Configuring the Nginx Reverse Proxy Block Create a dedicated Nginx configuration file for your AI endpoint at /etc/nginx/sites-available/vllm.conf : # Rate limiting zone for API requests limit_req_zone $binary_remote_addr zo...

Building High-Performance AI Infrastructure on Linux: From NVIDIA Drivers to vLLM Production Deployments

  The modern Machine Learning landscape relies entirely on Linux infrastructure. While high-level framework developments like PyTorch, Hugging Face, and LangChain dominate developer discussions, the actual engine serving low-latency inference at scale sits directly on Linux kernels, GPU acceleration drivers, and containerized serving engines. In this guide, we will step through the core architecture required to turn a raw Linux server (Ubuntu/Debian or RHEL/Rocky) into a high-throughput, OpenAI-compatible AI inference endpoint using vLLM and Docker . 1. Prerequisites & Linux Kernel Preparation Before running any Large Language Model (LLM) inference engine, your host operating system must be properly configured with NVIDIA proprietary drivers and the NVIDIA Container Toolkit to allow Docker containers direct access to host GPU acceleration. Step 1.1: Verify GPU Hardware Ensure your host system correctly detects all installed NVIDIA GPUs: Bash # Check PCI bus for recognized NVI...

GPU Monitoring & Metrics for MLOps

GPU Infrastructure Monitoring for MLOps: Essential nvidia-smi Commands & Metrics When running large-scale AI workloads, memory leaks, thermal throttling, and runaway PyTorch processes can crash inference nodes without warning. System administrators managing AI infrastructure need real-time visibility into GPU VRAM utilization, power draw, and process ownership. 1. Advanced nvidia-smi Query Commands Instead of running standard nvidia-smi , extract structured CSV data for custom log monitors or automated scripts: # Stream GPU VRAM usage, temperature, and power consumption every 2 seconds nvidia-smi --query-gpu=timestamp,name,temperature.gpu,utilization.gpu,utilization.memory,memory.used,memory.free --format=csv -l 2 2. Identifying Specific GPU Process Owners To identify which Python or Docker container is consuming GPU VRAM on multi-tenant servers: # List all active GPU compute processes with Process IDs (PIDs) nvidia-smi pmon -s u -v Once you locate a runaway pro...