Cloud Technology

How does Hadoop HDFS handle the "Small File Problem" in high-volume data ingestion pipelines?

MI Asked by Michael Thompson · 14-03-2024
0 upvotes 14,291 views 0 comments
The question

I am currently designing a data pipeline where we receive millions of small JSON files daily. I’ve heard that Hadoop HDFS is notorious for the "Small File Problem" because it overloads the NameNode memory with metadata. Is this still a critical issue in 2024, and what are the best industry-standard practices to consolidate these files before or after they hit the cluster?

3 answers

0
JE
Answered on 16-03-2024

The small file problem remains a significant bottleneck for NameNode scalability because every object in HDFS (file or block) takes up roughly 150 bytes of metadata in the master node's RAM. When you have millions of tiny files, you'll exhaust memory long before you run out of actual disk space on your DataNodes. In recent deployments, we typically use Apache NiFi to merge records into larger batches (aiming for the 128MB or 256MB block size) before ingestion. Alternatively, using Hadoop Archives (HAR) or SequenceFiles can effectively pack these smaller files into a single container.

0
RO
Answered on 18-03-2024

Have you considered using a compaction layer like Apache Iceberg or Delta Lake on top of your HDFS to handle these updates and small file merges automatically?

DA 19-03-2024

Robert, that's a great point. While Iceberg helps with table-level compaction, it still requires a periodic maintenance job to rewrite those small files into larger parity files. For Michael's specific JSON ingestion, I'd suggest a 'Lambda' approach where you land data in a 'staging' area first, run a Spark job to coalesce the partitions, and then move the "clean" larger files into the main HDFS production directory to keep the NameNode healthy.

0
EM
Answered on 20-03-2024

We usually just implement a cron job that runs a MapReduce 'FileConcat' or uses 'CombineFileInputFormat' to group those small splits into a single mapper for better performance.

MI 22-03-2024

I agree with Emily; 'CombineFileInputFormat' is a lifesaver for MapReduce jobs. It prevents the overhead of launching one mapper per tiny file, which usually kills the job's execution time.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session