New Delhi, India
ProjectsMarch 1, 2025

High-Throughput On-Premises NAS to Azure Blob Migration Pipeline

Azure Blob
AzCopy v10
Batch Optimization
Linux Concurrency
Bash / Go
High-Throughput On-Premises NAS to Azure Blob Migration Pipeline
Moving large volumes of on-premises unstructured data to the cloud is rarely limited by raw network bandwidth alone. In real-world enterprise environments, pipeline architecture, process orchestration overhead, and protocol handshakes frequently create severe performance bottlenecks long before network links saturate. Ahead of a major enterprise cloud migration, I was tasked with engineering, profiling, and optimizing the core data loader responsible for migrating high-density Network Attached Storage (NAS) datasets into Azure Blob Storage.
  • Total Dataset Volume: ~126 TB
  • Total File Count: ~1.6 Million files
  • Source Environment: On-premises enterprise NAS storage arrays (NFS/SMB multi-tier shares)
  • Target Environment: Azure Blob Storage (General Purpose v2, hot/cool access tiers, secured via SAS tokens and private networking)
  • Primary Tooling: Microsoft Azure azcopy (v10+), Bash orchestrator, Linux migration staging hosts
The initial legacy loader script was functionally accurate, but its architecture was brutal on system resources. On a standard test batch workload, the initial script required 33 minutes and 08 seconds. Extrapolating that rate across 126 TB and 1.6 million files meant the migration would have required weeks of uninterrupted execution, completely blowing past scheduled maintenance windows, risking mid-flight connection drops, and saturating the on-premises NAS. By diagnosing the underlying operating system bottlenecks and re-architecting the loader across three engineering iterations, I eliminated per-file process spawning, resolved a hidden double-execution bug, and pivoted to a validated batch manifest concurrency model. The result: the exact same workload dropped from 33m 08s down to 1m 12s (72 seconds) - a 27.6x speedup representing a 99.29% reduction in pipeline step duration, while drastically lowering NAS storage controller load, eliminating process churn, and preserving 100% data integrity.
The following diagram illustrates the migration topography and contrasts the architectural differences between the initial serial loop (v1) and the optimized batch manifest pipeline (v3):
Storage Workflow Optimization: v1 Serial Bottleneck vs v3 Batch Manifest Pipeline
The original migration script followed an intuitive, linear shell pattern: discover files locally, loop through each path one by one, invoke azcopy copy, and inspect stdout to ensure success. While functionally accurate, running this model against high-density file shares exposed three compounding bottlenecks: The script spawned a separate azcopy copy process for every individual file. Because azcopy is a compiled Go binary, the operating system had to repeatedly fork subshells, initialize the Go runtime, spin up internal scheduler threads, parse environment variables and authentication tokens, and load system TLS root CA bundles from disk. Across 1.6 million files, process initialization alone burned immense CPU context-switching time. Furthermore, every single invocation started with a cold network socket: a fresh TCP 3-way handshake and TLS 1.3 session negotiation occurred per file, preventing TCP slow-start from opening the congestion window and capping effective upload throughput at ~0.8 MB/s. A logic flaw in the pre-check and transfer wrapper inadvertently triggered an evaluation branch that executed azcopy twice per file: once during an initial pre-check / existence evaluation, and a second time for the actual payload copy. Across 1.6 million files, this flaw committed the pipeline to 3.2 million independent process executions. The script wrapped shell-level log parsing around every single azcopy call, redirecting output to temporary files and running string matching via grep: This generated millions of disk write operations, created severe subshell I/O churn, and flooded the on-premises NAS with continuous metadata queries (getattr, lookup, open) that degraded storage array performance for other enterprise workloads.
To resolve the throughput crisis while keeping data safety guarantees intact, I progressed through three focused iterations:
  • Execution Model: Single-file while-loop with double azcopy invocations and per-file Bash log parsing.
  • Characteristics: High NAS controller metadata contention, 3.2M projected process forks, cold TCP/TLS connections on every file.
  • Execution Model: Single-file loop with the double-execution bug eliminated and shell wrapper streamlined.
  • Remediation: Consolidated the execution path so azcopy was invoked strictly once per file, while keeping all target folder structure translations, destination path sanitization, and error-logging guarantees intact.
  • Result: Runtime dropped by ~60% on the same benchmark dataset (~13m 15s).
  • Architectural Conclusion: While the bug fix delivered a measurable speedup, a 13-minute runtime for a small test batch was still far too slow for 126 TB. Serial process spawning, subshell log inspection, and connection teardown remained the fundamental architectural ceiling.
  • Execution Model: Replaced the per-file execution loop with a validated batch manifest (--list-of-files).
  • Core Shift: Instead of managing concurrency and file iteration in Bash, a single azcopy job per batch handles parallel transfers internally using its native Go concurrency engine.
  • Preserved Guarantees: Retained exact target folder layouts, checksum verification, and validation rules, with orders of magnitude less chatter.
  1. Goroutine Worker Pools: A single long-lived process coordinates dozens of parallel transfer threads (AZCOPY_CONCURRENCY_VALUE), maximizing parallel throughput without OS process churn.
  2. Persistent HTTP/2 Connection Pooling: AzCopy keeps a pool of long-lived TCP/TLS sockets open. Files are streamed across multiplexed connections, eliminating handshake latency.
  3. Smooth Sequential Reads on NAS: The NAS sees continuous streaming reads rather than millions of discrete metadata lock requests.
The three iterations were benchmarked against identical datasets to measure execution time, process overhead, and network efficiency:
  • v1: Baseline (~33m 08s)
    • Execution Model: 1 azcopy process per file + double-execution bug + per-call Bash log parsing
    • Benchmark Runtime: ~33m 08s
    • Outcome: High on-premises NAS metadata lock contention, 3.2M projected process forks, severe process overhead
  • v2: Bug Remediation (~13m 15s)
    • Execution Model: 1 azcopy process per file (double-execution bug fixed + Bash wrapper cleanup)
    • Benchmark Runtime: ~13m 15s (~60% faster than v1)
    • Outcome: Removed duplicate invocations, but still fundamentally bound by serial process startup and connection teardown
  • v3: Validated Batch Engine (~1m 12s)
    • Execution Model: Validated --list-of-files manifest (1 long-lived azcopy job per batch)
    • Benchmark Runtime: ~1m 12s (72 seconds) (~27x faster)
    • Outcome: 99.29% step duration reduction, internal Goroutine concurrency, persistent HTTP/2 socket reuse, zero NAS lock churn
To validate the batch manifest architecture under controlled conditions before rolling it out across production data shares, I executed a dedicated benchmark run with a 200-file manifest:
  • Total Files in Batch: 200 files
  • Total Payload Size: 2,952,800,324 bytes (~2.95 GB)
  • Completed Transfers: 200 files (100%)
  • Failed Transfers: 0
  • Skipped Transfers: 0
  • Elapsed Duration: 0.4673 minutes (~28 seconds)
  • Final Job Status: Completed
During the v3 batch test, a subtle integration discrepancy surfaced between AzCopy and the surrounding wrapper: Even after AzCopy successfully transferred all 200 files and exited with Final Job Status: Completed, the legacy Bash summary wrapper printed: The original v1/v2 wrapper was written to grep for single-file status lines on each iteration. When we switched to --list-of-files, AzCopy ceased printing individual per-file completion lines to stdout. Instead, it emitted an aggregated batch job summary block at the end of the run. Because the old parser was searching for obsolete line formats, it recorded zero successful transfers despite 100% of the payload landing safely in Azure Blob Storage. I updated the summary parser to extract metrics directly from AzCopy's batch summary block: This ensured that operational dashboards, alerting pipelines, and downstream reconciliation checks received 100% accurate telemetry without manual verification.
This optimization reinforced core principles for large-scale enterprise cloud migrations: Invoking CLI tools like azcopy, aws s3 cp, or gcloud storage inside a shell loop is an anti-pattern. While acceptable for dozens of files, it fails catastrophically at scale due to process initialization costs, memory allocation, and connection teardown. In high-throughput storage pipelines, file discovery (manifest generation) should always be decoupled from data transport. Generating a sanitized --list-of-files manifest allows the transfer engine to stream at line speed without stalling for directory traversal. When refactoring from serial to batch execution, log formats and telemetry structures change fundamentally. Always verify that monitoring and alerting wrappers parse the batch summary block rather than expecting legacy per-file stdout signatures. Modern data transfer tools built in compiled languages (Go) feature sophisticated internal concurrency routines, multiplexed network clients, and memory ring buffers. Feeding these engines through validated batch manifests yields orders of magnitude higher throughput than any shell-level concurrency can achieve.
Azure Blob Storage · AzCopy v10 · Enterprise NAS · Data Migration · Performance Optimization · Linux Systems · Bash · Concurrency Engineering · SRE

Related projects

ATS Certify: Modular Resume Engineering & AI Evaluation Architecture

ATS Certify: Modular Resume Engineering & AI Evaluation Architecture

Architected an end-to-end resume engineering and ATS evaluation platform featuring a zero-backend client-side vector builder (pdf-lib / docx) and a decoupled hybrid evaluation engine (Next.js 14, Python FastAPI with PyMuPDF, and pluggable Gemini/Ollama scoring adapters), backed by a 5-stage distributed roadmap to scale to 1 million users.
Next.js 14
Python FastAPI
Gemini API
PyMuPDF
pdf-lib
Zero-Downtime AKS Platform Migration via Flux GitOps

Zero-Downtime AKS Platform Migration via Flux GitOps

Orchestrated a zero-downtime migration of a live, traffic-serving Azure Kubernetes Service (AKS) cluster sharing an Azure Resource Group using Flux v2 GitOps across 15,512 lines of code and 107 files.
Kubernetes
Azure AKS
Terraform
FluxCD
Disaster Recovery