1

I am working on an microservice that is developed using Vertx framework. One of service receives 100s(400 average) of events per second from event bus and it is written to MSSQL DB. Queries are executed using JDBCPool and currently configured with 40 as max number of connection. C3P0 is used for connection pooling.

My problem is, sometime the pool got exhausted and there are lot of statements waiting to be executed and this make whole application un-responsive. If I increase the pool size the DB exhibit slowness which affects other services also. So I am planning to write event to a Queue and poll the event from queue and then write to db, by this way I can control number of connections to DB by increasing/decreasing the number poller instance.

Current design

Source system -> Event bus -> Async IO -> DB

Proposed design

Source system -> Event bus -> Queue -> Polling -> DB

To keep it simple, I am trying to replace the DB IO async part with kind of sync. Code

  poll(){
        // poll queue with 100ms timeout
        //after getting event from queue call dao
        dao.insert(event)
           .onSuccess(statValObj -> {
               poll();
           })
    }

The above looks like a recursion, so would it impact vertx eventloop?

Can connection pool size limit the number of queries/operation without freezing the entire call stack?

Vertx version - 4.2.0

java_dev
  • 323
  • 6
  • 17
  • What is the cpu usage on the app and the DB? Is the disk on the DB ssd? How many writes per second do you see happening on the DB? What instance size is the DB? – Asad Awadia Oct 08 '22 at 18:37
  • CPU usage on app server is less than 1% and it is executing 400 update statements max and 100 on average, DB is managed by another team so I don't have much info on. From TCP dump I noticed that all the statements got response from DB server within few milli seconds. – java_dev Oct 12 '22 at 08:19

0 Answers0