โ02-13-2024 03:27 PM
Hi
Originally, I only have 1 pipeline looking to a directory. Now as a test, I cloned the existing pipeline and edited the settings to a different catalog. Now both pipelines is basically reading the same directory path and running continuous mode.
Question.
Does this create file locks when pipeline 1 reads these files using Autoloader?
Cheers,
โ02-13-2024 10:18 PM
Hey @Gilg
Thanks for bringing up your concern. Let's delve into this running two Delta Live pipelines reading from the same directory path in continuous mode, even with different catalogs, will not create file locks why I think so?:
โ02-14-2024 12:05 AM
Hi @Gilg, When multiple pipelines are simultaneously accessing the same directory path and utilizing Autoloader in continuous mode, it is crucial to consider the management of file locks and data consistency carefully.
Let's delve into the specifics of how Autoloader operates in this scenario.
Autoloader is designed to efficiently transfer data from various file types, such as Parquet files, into Delta tables. As it discovers these files, their corresponding metadata is stored in a highly scalable key-value store, specifically RocksDB, located within the checkpoint location of your Autoloader pipeline. This key-value store guarantees that data is only processed once, ensuring accurate and reliable results.
The behaviour of file writes is heavily influenced by the method used to upload files to the directory by the source system. Some methods may start by creating an empty file and then gradually add chunks of data, while others may first create a temporary file and then use an atomic operation to rename it. In situations where files are still being written to the directory, Autoloader might come across incomplete files or files that have not yet fully appeared.
There is a concerning risk when multiple pipelines are reading from the same directory, as it may result in data loss. This can occur if one pipeline attempts to read a file that is still being written by another. While the autoloader feature does not have built-in safeguards to prevent this, it can still occur if certain conditions are met, such as the way files are uploaded and the atomicity of those actions. To avoid such issues, it is important to carefully consider the protocols and processes surrounding file management within the directory.
โ02-14-2024 12:33 PM - edited โ02-14-2024 12:43 PM
Thanks @Kaniz_Fatma
The files that I am reading is from a Service Bus. These files contain only 1 data in a Json format and contains different sizes from bytes to kb.
The issue that I am getting is that autoloader seems to be in idle for a long time (1.5h) before it writes the data in bronze. I was also thinking because by default autoloader's maxFilesPerTrigger by default is 1000 files for each micro-batch. It seems like autoloader is waiting to meet that criterion before it triggers the micro-batch.
Also, one thing that I noticed when looking at the sparkUI is that jobs/stages are finished within seconds. So, maybe the majority of the time spent on listing the directory and maintaining the checkpoint. If so, is there a method to reduce this behavior.
Lastly, when the micro-batch process is done, the records seem up to date.
โ02-14-2024 10:22 PM
Hi @Gilg, Itโs great to see you working with data ingestion using Auto Loader in Databricks.
Letโs address your observations and explore potential solutions:
Idle Time and Max Files Per Trigger:
Listing Directory and Checkpoint Overhead:
Up-to-Date Records:
โ02-22-2024 05:27 PM
Hi @Kaniz_Fatma
We are receiving around 6k worth of files every hour, or 99 files per minute and these files can vary is sizes.
One thing I also notices is that the Scheduler Delay seems taking it too long like 1hr upto 2hrs.
We are already using ADLS Gen2, Bronze table are in Delta format, and not using any schema inference. So not sure what is going on in our DLT pipeline.
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group