Horizontal scaling of a drools microservice? Shared working memory?

49 views
Skip to first unread message

Vishesh Mukherjee

unread,
Jan 18, 2025, 5:16:04 AMJan 18
to Drools Usage

I have an application that takes rules via the REST API and updates the working memory. Using this approach, I can add new rules, update existing rules, and delete rules on the fly programmatically. I want to run the application on multiple nodes, but if a request hits a single node, the working memory on all other nodes will not be updated.

I considered using the following approaches, but they each have their own set of problems:

  • Broadcasting the request to all the nodes: The problem with this approach is that if all the nodes are updating at the same time, I will face downtime. Additionally, if one node fails due to the request, there is a chance that the others might fail as well.

  • Using RabbitMQ: If one node successfully updates the working memory, that node can broadcast the request to all the other nodes. However, in the end, all the nodes need to process the request again in order to update their working memory. I want to avoid using an event-based approach, as if a node doesn't receive the event, it will not update its working memory.

I have reviewed the approaches mentioned in this conversation, such as SpringBoot + Drools in AKS

I'm looking for a solution where, if a node successfully processes the request and updates its working memory, that working memory is somehow shared across all the other nodes.

Alex Porcelli

unread,
Jan 18, 2025, 6:54:13 PMJan 18
to drools...@googlegroups.com
A few observations...

My first recommendation is to avoid updating rules on the fly, in a
containerized environment it's expected that container images are
immutable; consider a scenario that you update on the fly a rule, the
container goes down and is provisioned in a different node (same would
happen if you have auto-scale the containerized application)... in
these cases you have the containers out of sync. The alternative
approach is to leverage the container orchestrator, relying on a
rollout deployment strategy.

Although there was research in the past to create distributed working
memory, this hasn't been involved much. A good alternative you listed
is relying on RabbitMQ/AMQ/Kafka.

Last, but not least, I'd recommend you take a look at 10.0.0 - as this
is the current version in active development.
https://kie.apache.org/docs/start/download

-
Alex
> --
> You received this message because you are subscribed to the Google Groups "Drools Usage" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/drools-usage/c07149b5-db01-445a-bf83-52f31bf3ac7bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages