Delayed processing and Rate limiting

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Delayed processing and Rate limiting

PoolakkalMukkath, Shakir

Hi Flink Team,

 

I am looking for some direction/recommendation for below tasks

 

  1. Delayed Processing:

Having a use case where we need to process events after a time-delay from event time. Let’s say, the event happened at time t1, and it reached the Flink immediately, but I have to wait t1+2min to process this.

We are sourcing the events from Kafka, we like this applied after SourceFn. May be we can do this by ThreadSleep() on a MapFn, but looking if there is a better way to achieve this.  

 

  1. Rate Limit External Data Access

The best practices to implement rate limiting to external service, it can be either on mapFn or AsynchFn. What is the recommended approach to rate limit and  build backpressure.

 

Thanks in advance

 

Thanks,

Shakir

Reply | Threaded
Open this post in threaded view
|

Re: Delayed processing and Rate limiting

Victor Wong

Hi Shakir,

 

> Delayed Processing

Maybe you can make use of the function ‘org.apache.flink.streaming.api.TimerService#registerProcessingTimeTimer’, check this doc for more details:

https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/process_function.html#example

 

> Rate Limit External Data Access

With AsyncFunction, you can set a ‘capacity’ which defines how many asynchronous requests may be in progress at the same time, I’m not sure if this is what you need or not.

Check this doc for more details: https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/asyncio.html#async-io-api

 

Best,

Victor

 

From: "PoolakkalMukkath, Shakir" <[hidden email]>
Date: Wednesday, August 7, 2019 at 10:06 PM
To: user <[hidden email]>
Subject: Delayed processing and Rate limiting

 

Hi Flink Team,

 

I am looking for some direction/recommendation for below tasks

 

  1. Delayed Processing:

Having a use case where we need to process events after a time-delay from event time. Let’s say, the event happened at time t1, and it reached the Flink immediately, but I have to wait t1+2min to process this.

We are sourcing the events from Kafka, we like this applied after SourceFn. May be we can do this by ThreadSleep() on a MapFn, but looking if there is a better way to achieve this.  

 

  1. Rate Limit External Data Access

The best practices to implement rate limiting to external service, it can be either on mapFn or AsynchFn. What is the recommended approach to rate limit and  build backpressure.

 

Thanks in advance

 

Thanks,

Shakir