I rarely write about the data work that I’m doing, so here’s something from that part of the wheelhouse. Had a chance to rework a data pipeline that was ingesting AIS vessel navigation data and it had a few common ‘anti-patterns’ that are worth highlighting. This was in Azure ecosystem, but the principles apply across all the different cloud providers.
How things were setup:
Subsequent pipelines would read all the parquet files, combine them and write to Silver layer and so on.
This setup is the classic example of the small file problem for data lakes. Writing a file per message means the system was generating 90-100k files per day. Using parquet as target file format was greatly exacerbating the issue as the parquet file format overhead (parquet files have a largish header describing file structure and compression metadata) wasn’t compensated by data compression as there were at most 2-3 records a file.
So we had 90-100k files added daily, roughly 9GB in size, and as is usual in datalakes we don’t delete the history, so it’s a 3 TB / year storage just for the incoming messages. Combining the 90k files for reading into Silver layer was also taking a fair bit of time.
So how do you improve this?
By trying to make files bigger :) So we switched:
This change had a pretty dramatic effect:
So be careful with all the modern data tools, they’re built for large scale so throwing dust at them will grind them to a halt and will also cost a fair bit along the way.