NewsCrawler.org

Databricks Auto Loader listed two months of files each run, slowing a batch to 30 minutes

30分かかるバッチ、実はデータ処理はたった数秒だった:Databricks Auto Loaderの裏側を調べてみた
映画「ハスラー2」の日本版ポスター
2025年7月29日 18:05開始のラン。ストリーミングテーブルの更新に31分35秒かかり、2,698件を取り込んでいる
バッチの実行時間推移。最初のバッチだけ29.66分と突出して長い
Image: zenn.dev

The author, a data engineer at IVRy, runs a streaming pipeline that uses Auto Loader[1] to load JSON files from AWS S3 in hourly micro-batches. On 29 July 2025, a run that loaded 2,698 files took 31 minutes 35 seconds, and the first batch alone took 29.66 minutes. Databricks support found that about 29.16 minutes went to the latestOffset phase, where Auto Loader looks for new files, while the actual query processing finished in seconds.

Auto Loader normally uses Incremental Listing[2], which reads only the paths after the last listed path and assumes new files sort after existing ones. Here, about 80% of new files were out of order, far above the 5% threshold, because previously created files were overwritten and kept their old paths. Auto Loader therefore switched to a backfill[3] that listed the whole directory, covering about two months of files on each run. Setting modifiedAfter did not help, because the S3 list API can only filter by prefix.

As a temporary fix, the team passed only the previous day's date directory to the load path, with the date calculated in JST. The permanent fix under consideration is switching to file notification mode[4], which detects new files through S3 event notifications and SQS, although this may conflict with existing notification settings. Incremental Listing is deprecated and disabled by default in Databricks Runtime 17.3 and later.

Read the original zenn.dev

Sources

  • Zenn JA

    30分かかるバッチ、実はデータ処理はたった数秒だった:Databricks Auto Loaderの裏側を調べてみた

    17 likes2 bookmarks0 comments

Published: First seen: Читать по-русски

Open as a page