Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3250

query construct: Unexpected high memory usage and implicit performance degradation whereas query is NOT called

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 5.3.0.CR1
    • drools-core
    • None
    • Hide

      1) create a fact type (s. below)
      2) use a DRL file as seen below.
      3) insert lots of facts (e.g. 850,000; file attached(

      public class MediumSubPlanningOpt
      {
      private Long mediId;
      private Long suplId;
      ...
      }

      public class WorkingMemoryFiller {
      ...
      List<MediumSubPlanningOpt> mesos = readCSVData();
      for (MediumSubPlanningOpt ms : mesos)

      { getWorkingMemory().insert(ms); }

      }

      DRL: File
      query "QUERY_IS_REALLY_NOT_CALLED" (long pSpmaId, long pSuplId, long pFarrId)
      (or
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      )
      end

      query "QUERY_IS_REALLY_NOT_CALLED2" (long pSpmaId, long pSuplId, long pFarrId)
      (or
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $mss: MediumSubPlanningOpt(suplId == pSuplId)
      )
      )
      end

      query "REALLYREALLYUNUSED" (long pSpmaId, long pSuplId)
      (or
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      (
      $ms: MediumSubPlanningOpt(suplId == pSuplId)
      )
      )
      end

      Show
      1) create a fact type (s. below) 2) use a DRL file as seen below. 3) insert lots of facts (e.g. 850,000; file attached( public class MediumSubPlanningOpt { private Long mediId; private Long suplId; ... } public class WorkingMemoryFiller { ... List<MediumSubPlanningOpt> mesos = readCSVData(); for (MediumSubPlanningOpt ms : mesos) { getWorkingMemory().insert(ms); } } DRL: File query "QUERY_IS_REALLY_NOT_CALLED" (long pSpmaId, long pSuplId, long pFarrId) (or ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ) end query "QUERY_IS_REALLY_NOT_CALLED2" (long pSpmaId, long pSuplId, long pFarrId) (or ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ( $mss: MediumSubPlanningOpt(suplId == pSuplId) ) ) end query "REALLYREALLYUNUSED" (long pSpmaId, long pSuplId) (or ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ( $ms: MediumSubPlanningOpt(suplId == pSuplId) ) ) end

    Description

      Inserting 850,000 facts of one fact type into working memory results in memory usage (and implicitly in performance degradation) related to the count of occurences of the fact in queries.

      Note: The queries are NOT called. No Rules are fired.

      Memory impact is about 500 MB on heap qith the shown query.
      Performance impact was factor 5 (which maybe cannot be observed with this example).

      Attachments

        Activity

          People

            mproctor@redhat.com Mark Proctor
            oomphar Roman Novak (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty