Hi Sanket, I have a similar use case. how are you measuring the time for Async1` function to return the result and external api call
On Wed, Sep 29, 2021 at 10:47 AM Sanket Agrawal <sanket.agra...@infosys.com> wrote: > Hi @Piotr Nowojski <pnowoj...@apache.org>, > > > > Thank you for replying back. Yes, first async is taking between 1300-1500 > milliseconds but that is called on a CompletableFuture.*supplyAsync *and > the Async Capacity is set to 1000. > > > > *Async Code Structure*: Inside asyncInvoke we are calling > CompletableFuture.*supplyAsync *and inside* supplyAsync *we are calling > an external API which is taking around 1005ms to 1040ms. Rest of the code > for request creation/response validation is also inside the* supplyAsync *and > is taking around 250ms. > > > > This way we tried that the main Async thread(as the async does not uses > multiple threads directly) is available for the next message as soon as it > calls CompletableFuture.supplyAsync on the current message. > > > > Thanks, > > Sanket Agrawal > > > > *From:* Piotr Nowojski <pnowoj...@apache.org> > *Sent:* Tuesday, September 28, 2021 8:02 PM > *To:* Sanket Agrawal <sanket.agra...@infosys.com> > *Cc:* user@flink.apache.org > *Subject:* Re: Event is taking a lot of time between the operators > > > > [**EXTERNAL EMAIL**] > > Hi, > > > > With Flink 1.8.0 I'm not sure how reliable the backpressure status is in > the WebUI when it comes to the Async operators. If I remember correctly > until around Flink 1.10 (+/- 2 version) backpressure monitoring was > checking for thread dumps stuck in requesting Flink's network memory > buffers. If in your job AsyncFunction is the source of a backpressure, it > would be skipped and not reported. For analysing backpressure I would > highly recommend upgrading to Flink 1.13.x as it has greatly improved > tooling for that [1]. And in that version AsynFunctions are definitely > handled correctly. Since Flink 1.10 I believe you can use the > `isBackPressured` metric. In previous versions you would have to rely on > buffer usage metrics as described here [2]. > > > > > > [1] https://flink.apache.org/2021/07/07/backpressure.html > <https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fflink.apache.org%2F2021%2F07%2F07%2Fbackpressure.html&data=04%7C01%7Csanket.agrawal%40infosys.com%7C23f3adeda77d49df701e08d9828cf9be%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637684364264365935%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jHbzq5R3ObWWE9XjNpyVFi9bZl9QMIJQp13ZPd%2BMb00%3D&reserved=0> > > [2] > https://flink.apache.org/2019/07/23/flink-network-stack-2.html#network-metrics > <https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fflink.apache.org%2F2019%2F07%2F23%2Fflink-network-stack-2.html%23network-metrics&data=04%7C01%7Csanket.agrawal%40infosys.com%7C23f3adeda77d49df701e08d9828cf9be%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637684364264365935%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=KIcL8H1ztS67z5U%2FPZnhnYvlwYM8jNhl9K1sD1GYQHg%3D&reserved=0> > > > > Apart of the back pressure, part of the problem might be simply how long > does it take for `Async1` function to return the result. Have you checked > that? Isn't it taking a couple of seconds? > > > > Best, > > Piotrek > > > > wt., 28 wrz 2021 o 15:55 Sanket Agrawal <sanket.agra...@infosys.com> > napisaĆ(a): > > Hi All, > > > > I am new to Flink. While developing a Flink application We observed that > our message is taking around 10 seconds between the two Async operators. > Below are the details. > > > > - *Flink Flow*: Kinesis Source -> Process -> Async1 -> Async2 -> > Process -> Kinesis Sink > - *Environment*: Amazon KDA. 1 Kinesis Processing Unit (1vCore & 4GB > ram), and 1 parallelism. > - *Flink Version*: 1.8.0 > - *Backpressure*: Flink dashboard shows that backpressure is *OK.* > - *Input rate: *60 messages per second. > > > > Any kind of pointers/help will be very useful. > > > > Thanks, > > Sanket Agrawal > > > >