4 Replies Latest reply on Jun 2, 2014 12:45 PM by dward

    drools initial performance lag

    richardhands

      We've got a switchyard project that contains .drl files inside it containing quite a lot of business rules. When we hit the rules for the first time, there is a noticable 'lag', presumably whilst it's compiling/loading the rules into the knowledgebase, which, when under load, can cause our service to timeout.

       

      Is there a good way to get the drools preloaded into the knowledgebase before the service hits it, maybe on application start?

       

      or is there some other way we can package our rules, which will mean that we don't take this hit?

       

      thanks

        • 1. Re: drools initial performance lag
          dward

          What version of SwitchYard are you using? And are you using a manifest/resources or manifest/container? If using the manifest/resources configuration option, then it should pre-load a knowledge base on deployment.

          • 2. Re: drools initial performance lag
            richardhands

            We're using 1.1.0-Final, and we're using manifest/resources.  If, as you say, theres a kb loaded on deployment, is there some way i can monitor what's going on around the kb when the rules are fired, so that i can try and work out what it's doing under the covers?  classes/methods to breakpoint so i can sneak a peek, or logging levels i can turn up to get further info?  I know i could add loggers/event listeners in via the switchyard file but i just wondered if there's anything built in i can use first?

             

            cheers :-)

            • 3. Re: drools initial performance lag
              richardhands

              After some further investigation and deep log analysis i've managed to nail down that it's actually not drools that's running slowly (in fact drools is running blindingly fast as i'd hope), it's actually hitting a DB stored procedure that's taking ~14 seconds on first hit, and we appear to be having some speed issues around connection pooling, so i'll look to get the admins to increase the min pool size etc to ensure there are always some available connections ready to pick up, and talk to the DB guys about what their proc does.

               

              thanks for the help though, it's nice to know that it does load the kbase on startup.

              • 4. Re: drools initial performance lag
                dward

                Wow - good find!


                If you can't get the stored proc optimized, you could implement some kind of startup listener on your application that triggers the stored procedure during deployment, such that real users won't feel the hit.