Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6556

JSON marshalling slow due to inefficient com.fasterxml.jackson.databind.type.TypeFactory.findClass calls

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 7.60.0.Final
    • 7.58.0.Final
    • kie server
    • 2021 Week 34-36 (from Aug 23)
    • 5
    • undefined
    • NEW
    • NEW

      Running load tests against a rules kjar on kie-server, we observed a performance hit with increased concurrency. We are using JSON and the input data is quite large. Collecting thread dumps during the load tests shows many threads in the following BLOCKED state:

      "default task-14" #427 prio=5 os_prio=0 cpu=1351.14ms elapsed=13.44s tid=0x000055613aef7000 nid=0x1cc89 waiting for monitor entry  [0x00007f5d824b8000]
         java.lang.Thread.State: BLOCKED (on object monitor)
      	at java.lang.Class.forName0(java.base@11.0.7/Native Method)
      	at java.lang.Class.forName(java.base@11.0.7/Class.java:398)
      	at com.fasterxml.jackson.databind.type.TypeFactory.classForName(TypeFactory.java:329)
      	at com.fasterxml.jackson.databind.type.TypeFactory.findClass(TypeFactory.java:311)
      	at com.fasterxml.jackson.databind.DatabindContext.resolveAndValidateSubType(DatabindContext.java:231)
      	at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver._typeFromId(ClassNameIdResolver.java:72)
      	at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver.typeFromId(ClassNameIdResolver.java:66)
      	at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:156)
      	at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer._deserialize(AsWrapperTypeDeserializer.java:104)
      	at com.fasterxml.jackson.databind.jsontype.impl.AsWrapperTypeDeserializer.deserializeTypedFromObject(AsWrapperTypeDeserializer.java:52)
      	at org.kie.server.api.marshalling.json.JSONMarshaller$CustomAsWrapperTypeDeserializer.deserializeTypedFromObject(JSONMarshaller.java:942)
      

      Inspecting the TypeFactory.findClass calls, we noticed that these are executed not only for FQCN, but also for other elements of the input JSON data, resulting in a ClassNotFoundException that is not logged, but impacting performance.

            rhn-support-tkobayas Toshiya Kobayashi
            rhn-support-tkobayas Toshiya Kobayashi
            Karel Suta Karel Suta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: