tendermint/js-abci

Message handler concurrency

mappum opened this issue · 1 comments

Currently we pass messages to the app serially, blocking until the handler has returned a response. In the future, we will want to be able to handle messages concurrently, e.g. for processing checkTx requests in parallel for performance gains.

I have put a 10 second timer in checkTx (to simulate a database lookup / http call) as below:

  checkTx: (request) => {
    console.log("checkTx: ", request);
    return new Promise((resolve, reject) => {
      setTimeout(() => { console.log("resolving tx:", request); resolve({}); }, 10000);
    })
  }

Tendermint core started to error out on broadcastTxCommit:

Error on broadcastTxCommit   module=rpc err="Timed out waiting for tx to be included in a block"

When it is not erring out, It is still waiting for the 10 seconds to complete, before accept the next checkTx. So, if you have 10 users trying to call checkTx at the same time, and each one takes some time, then all the other will have to wait - the core is not accepting multiple checkTx calls simultaneously, it is waiting for the prior call to complete first.

Adding the ability to perform checkTx in parallel will remove that process bottleneck