title: Should I using async code or sync code in apache flink
body: <p>When my application interacts with IO (database, third API,...), I'm using Async as a recommendation of Flink: <a href="https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/asyncio.html" rel="nofollow noreferrer">https://ci.apache.org/projects/flink/flink-docs-stable/dev/stream/operators/asyncio.html</a>.
  But my application usually interacts with DB, should I always use async?</p>
  <p>I have many questions:</p>
  <ol>
  <li>If I using async (completablefuture), then my application is not blocked as when using sync code =&gt; In terms of performance, async code is better sync code?</li>
  <li>What is the performance if I using sync code and increase parallel?</li>
  <li>When I using async code, After a while, my application throw Exception &quot;Mailbox is in state CLOSED, but is required to be in state OPEN for put operations&quot;. Look like it's related to open many threads?</li>
  </ol>