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: 

Fetch new data from kinesis for every minute.

pranathisg97
New Contributor III

I want to fetch new data from kinesis source for every minute.

I'm using "minFetchPeriod" option and specified 60s. But this doesn't seem to be working.

Streaming query:

spark \

 .readStream \

 .format("kinesis") \

 .option("streamName", kinesis_stream_name) \

 .option("region", region name) \

 .option("initial Position", "latest") \

 .option("awsAccessKey", awsAccessKey) \

 .option("awsSecretKey", aws_secret_access_key)\

.option("minFetchPeriod","60s")

Can anyone help me on this ? I'm new to this topic.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

I was able to solve the issue by specifying maxFetchDuration value more than minFetchPeriod. However I didn't get the purpose of specifying maxFetchDuration value greater than or equal to minFetchPeriod value.

spark \

 .readStream \

 .format("kinesis") \

 .option("streamName", kinesis_stream_name) \

 .option("region", region name) \

 .option("initial Position", "latest") \

 .option("awsAccessKey", awsAccessKey) \

 .option("awsSecretKey", aws_secret_access_key)\

.option("maxFetchDuration","60s")\

.option("minFetchPeriod","60s")

View solution in original post

7 REPLIES 7

Debayan
Databricks Employee
Databricks Employee

Hi, What is the DBR you are running on it? Also, what is the error you get when it is not working?

pranathisg97
New Contributor III

Hi, DBR is 12.1

Error : "java.lang.IllegalArgumentException: maxFetchDuration needs to be a duration string such as '10s' for 10 seconds or '2m' for 2 minutes. Also needs to be greater than minFetchPeriod in order to avoid falling behind in the stream".

Do I have to configure maxFetchDuration whenever I configure minFetchPeriod ?

Anonymous
Not applicable

Hi @Pranathi Girish​ 

Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Hi,

I was able to solve the issue by specifying maxFetchDuration value more than minFetchPeriod. However I didn't get the purpose of specifying maxFetchDuration value greater than or equal to minFetchPeriod value.

spark \

 .readStream \

 .format("kinesis") \

 .option("streamName", kinesis_stream_name) \

 .option("region", region name) \

 .option("initial Position", "latest") \

 .option("awsAccessKey", awsAccessKey) \

 .option("awsSecretKey", aws_secret_access_key)\

.option("maxFetchDuration","60s")\

.option("minFetchPeriod","60s")

I would like to share the following docs with best practices when using kinesis https://docs.databricks.com/structured-streaming/kinesis-best-practices.html please check this doc. it will help you to undertand what does maxFetchDuration does.

Hi @Jose Gonzalez​ ,

Thanks for sharing the document. I would like to share my understanding from the document. Please correct me if I'm wrong.

minFetchPeriod is the time interval between consecutive pre-fetch between kinesis and spark. maxFetchDuration is the how long the pre-fetched data will be stored in buffer. In my case, after 60s data will be available to process.

But how the data from kinesis is pre-fetched?

Anonymous
Not applicable

Hi @Pranathi Girish​ 

Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.

Please help us select the best solution by clicking on "Select As Best" if it does.

Your feedback will help us ensure that we are providing the best possible service to you.

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