0

When I run my kogito quarkus drl project using maven mvn quarkus:dev, the rules extension gets loaded (I see it load during the build step). I test my project and the rules run very fast. Then, I run the same quarkus project inside a docker container and the rules extension doesn’t seem to load during quarkus startup. I test the app and the same rules run much slower inside the container. How can I get quarkus to load the rules extension at startup in side the container similar to the way maven loads the rules extension during the build step?

I tried to create a mutable-jar and added the build env var to quarkus app jar execute. But the doco says that is only for dev and not prod. So, what to use in prod??? I am confused on why prod mode does not load the rules extension.

Ken White
  • 123,280
  • 14
  • 225
  • 444
Rob C
  • 11
  • 2
  • you should consider sharing a reproducer (eg: a github project) and share it with kogito-development mailing list, since it seems you're using Quarkus hence I assume Drools via Kogito. – tarilabs Feb 22 '23 at 15:09
  • The git repo I am using is private, but I could easily build up a small quarkus app that would reproduce the issue and check it into a public git repo. – Rob C Feb 23 '23 at 01:02

2 Answers2

1

Update: After time testing various options, I found the speed of the rules varies based on application launch method.

I pulled the kogito-drl-quickstart from github. Then, I ran the following locally:

  1. When I launch the application in maven dev mode (mvn quarkus:dev), the rule speed was on average about 10ms.

  2. When I launch the application in JVM mode (java -jar target/quarkus-app/quarkus-run.jar), the rule speed was on average about 50ms.

  3. When I launch the application in native mode (target/kogito-drl-quickstart-1.0.0-SNAPSHOT-runner), the rule speed was on average about 5ms.

Based on all this, my conclusion is: if you are looking for fast prod rule speed, native execution is for sure the way to go with kogito. The plain JVM execution is very slow if your application has many rules and large data sets running through them.

Rob C
  • 11
  • 2
0

Then, I run the same quarkus project inside a docker container

This is a strong suspicious flag you might be building the docker container manually, and not following the approach advised by Kogito/Quarkus perhaps?

I would encourage trying build your docker container image via using the JIB extension, that way a docker image is produced as the result of mvnw install -Dquarkus.container-image.build=true

Ref: https://quarkus.io/guides/container-image#building

tarilabs
  • 2,178
  • 2
  • 15
  • 23
  • Yes The docker image was manual. But, even if a execute the following locally: java -jar target/quarkus-app/quarkus-run.jar This too yields slow rules. – Rob C Feb 23 '23 at 00:51
  • Anything other than mvn quarkus:dev - build, seems to not compile the drl files to .class equivalents. Hence the slow rule runtime. I think the rules are not being compiled at runtime then executed, which doesn’t happen in dev mode. Dev mode loads the rules extension which precompiles the drl files yielding fast rule execution times – Rob C Feb 23 '23 at 00:57