cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Databricks write to Azure Data Explorer writes suddenly become slower

RengarLee
Contributor

Now, I write to Azure Data explorer using Spark streaming. one day๏ผŒ writes suddenly become slower. restart is no effect.

I have a questions about Spark Streaming to Azure Data explorer.

Q1: What should I do to get performance to reply?

Figure 1 shows the performance of writing in the current table.

Figure 2 the performance of writing in the now table.

Figure 3 the performance of writing in the current table, but the checkpoint location is new.

Could it be that checkpoint location caused it?

1 ACCEPTED SOLUTION

Accepted Solutions

RengarLee
Contributor

I'm so sorry, I just thought the issue wasn't resolved

Solution

  1. Set maxFilesPerTrigger and maxBytesPerTrigger
  2. Enable autpoptimize

Reason

for the first day, it processes larger files and then eventually process smaller filesใ€‚

Detailed reason

Before performance drops๏ผš

Before performance drops1000 = (endOffset's index - startOffset's index) = ๏ผˆ80999- 79999๏ผ‰

1305389 = numInputRows    

avg records per files is 1305389/1000 = 1305.389

After performance drops๏ผšAfter1000 = (endOffset's index - startOffset's index) = ๏ผˆ90999- 89999๏ผ‰

45644= numInputRows    

avg records per files is 45644/1000 = 45

From the comparison of (1) and (2), it can be seen that the number of files read by each batch before and after the performance drop (23:30) remains unchanged at 1000, but after 23:30 the number of 1000 total files changes. Less, it is most likely that the file size has become smaller, resulting in a smaller file, so the total number of read items has decreased. That is, for the first day, it processes larger files and then eventually processes smaller files.

Suggestion๏ผš

https://docs.microsoft.com/en-gb/azure/databricks/delta/delta-streaming#limit-input-rate

https://docs.microsoft.com/en-us/azure/databricks/delta/optimizations/auto-optimize

โ€‹

โ€‹Finally, a big thank you to the Databricks team and the Microsoft team for their technical support.

View solution in original post

10 REPLIES 10

-werners-
Esteemed Contributor III

if the checkpoint location is in another region or has another 'level' (think premium vs standard storage) that could be the case.

Can you check that?

Thank you for your answer.

I check it.

data source๏ผˆAdxDF๏ผ‰ and checkpoint location is the same container, Only the path is different.

Azure Data Explorer and data source is the same region.

I have a new discovery.

โ€‹if I write to the new table. It's fast at first, and after a few hours of running, it suddenly slows down. 

โ€‹I'll add a screenshot later

โ€‹

User16764241763
Honored Contributor

Is it Blob storage or ADLS Storage account where your data and checkpoint files are stored?

It's Azure Data Lake Storage Gen2.

-werners-
Esteemed Contributor III

could it be the stream query that gets slow? Maybe checkpoint more often?

I'm very sorry to reply you now, this problem has been resolved, the specific reason is in another answer.

 

Do you have any more data to be process? check the driver logs for any errors messages? this suddenly drop might point to another issue happening here

I'm very sorry to reply you now, this problem has been resolved, the specific reason is in another answer.

RengarLee
Contributor

I'm so sorry, I just thought the issue wasn't resolved

Solution

  1. Set maxFilesPerTrigger and maxBytesPerTrigger
  2. Enable autpoptimize

Reason

for the first day, it processes larger files and then eventually process smaller filesใ€‚

Detailed reason

Before performance drops๏ผš

Before performance drops1000 = (endOffset's index - startOffset's index) = ๏ผˆ80999- 79999๏ผ‰

1305389 = numInputRows    

avg records per files is 1305389/1000 = 1305.389

After performance drops๏ผšAfter1000 = (endOffset's index - startOffset's index) = ๏ผˆ90999- 89999๏ผ‰

45644= numInputRows    

avg records per files is 45644/1000 = 45

From the comparison of (1) and (2), it can be seen that the number of files read by each batch before and after the performance drop (23:30) remains unchanged at 1000, but after 23:30 the number of 1000 total files changes. Less, it is most likely that the file size has become smaller, resulting in a smaller file, so the total number of read items has decreased. That is, for the first day, it processes larger files and then eventually processes smaller files.

Suggestion๏ผš

https://docs.microsoft.com/en-gb/azure/databricks/delta/delta-streaming#limit-input-rate

https://docs.microsoft.com/en-us/azure/databricks/delta/optimizations/auto-optimize

โ€‹

โ€‹Finally, a big thank you to the Databricks team and the Microsoft team for their technical support.

Connect with Databricks Users in Your Area

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