Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-3855

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.12.0.GA
    • 7.11.1.GA
    • Kie-Server
    • 1
    • False
    • False
    • ER3
    • -
    • undefined
    • 2021 Week 34-36 (from Aug 23), 2021 Week 37-39 (from Sep 13)

      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-mputz Martin Weiler (Inactive)
              Karel Suta Karel Suta
              Karel Suta Karel Suta
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: