Method: Measure, Change One Thing, Measure Again
- Define the symptom (slow listing, slow reads, job waits)
- Find the layer: client, NameNode, DataNode, disk, network
- Collect baseline numbers
- Change one setting or fix one cause
- Compare and write down the result
- Roll back if there is no gain
Benchmark First
Compare throughput per node with the speed of the disks and network. If 12 disks can give 1.5 GB/s and you see 200 MB/s, something is limiting.
NameNode Tuning
| Symptom | Check | Setting / action |
|---|---|---|
Slow ls, RPC timeouts | RpcQueueTimeAvgTime, CallQueueLength | Raise dfs.namenode.handler.count (about 20 x ln(cluster size)), enable the service RPC port for DataNode traffic |
| Long GC pauses | GC logs | Right-size heap, use G1GC, tune young gen, avoid swap |
| Block report storms | Startup time | Stagger dfs.blockreport.initialDelay, use incremental block reports |
| Lock contention | Slow on heavy writes | Fewer huge deletes at once, separate hot paths via federation |
| Audit log slows down | Disk IO | Use async audit logging and a separate disk |
DataNode Tuning
Short-Circuit Local Reads
When a client (for example a Spark executor) and a DataNode are on the same host, the client can read the block file directly instead of going through the DataNode over TCP.
Block Size
| Block size | Use |
|---|---|
| 128 MB (default) | General |
| 256 MB | Large sequential files (fewer blocks = less NameNode memory) |
| 64 MB or smaller | Rarely a good idea |
Block size is set per file at write time (dfs.blocksize). Changing the default does not affect existing files.
The Small File Problem
- Each file, directory and block costs about 150 bytes or more of NameNode heap
- Millions of 1 MB files waste memory, increase RPC load and create too many MapReduce/Spark tasks
- Hive, Spark and streaming jobs are the usual sources
| Fix | How |
|---|---|
| Compact in Spark/Hive | Read and write with coalesce(n) or INSERT OVERWRITE ... DISTRIBUTE BY, ALTER TABLE ... CONCATENATE (ORC) |
| Use container formats | ORC/Parquet instead of many text files, Avro or SequenceFile for logs |
| Hadoop archives (HAR) | hadoop archive -archiveName logs.har -p /logs /archive (read-only, still stresses name space less) |
| Stop the source | Streaming micro-batches: use larger triggers, Delta/Hudi/Iceberg compaction |
| Quotas | Name quota per team |
Network and OS Checks
await) can slow down a whole job because tasks wait for the slowest replica. Use SMART monitoring and dfs.datanode.slow.io.warning.threshold.ms logs to find outliers.
dfs.datanode.peer.stats.enabled, dfs.datanode.fileio.profiling.sampling.percentage) so slow nodes are reported in the NameNode UI.
Conclusion
Benchmark first, then tune: more NameNode handlers with a service RPC port, DataNode threads and volume policy, short-circuit reads, proper block sizes, and a real fix for small files. Always change one thing at a time.

