Vertx using shared hashmap instead of event bus

43 Views Asked by At

I've built a small app in Vertx that consumes market data from Kafka and makes it available to clients via GRPC. The data is very high volume, so I'm conflating the data and publishing the best prices every second. I've tried publishing this data on the event bus and with the use of a periodic timer, conflate the updates and publish to clients. The problem with this is Vertx is applying back pressure on the publishing part. I replaced the event bus with a hashmap and the performance improved 5x. I'm wondering if it's save to share state between two event handlers this way and not run into race conditions. I assume I'm fine because everything is executed on the same event loop? I don't want any back pressure to be applied prior to conflation. Any recommendations are appreciated.

0

There are 0 best solutions below