Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3048

Using builders leads to performance degradation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.9.2, 1.10.1
    • 1.11.0
    • java

    Description

      When you do a .newBuilder() for avro generated classes, this will call
      org.apache.avro.specific.SpecificData.getForSchema:

       

      public static SpecificData getForSchema(Schema reader) {

          if (reader.getType() == Type.RECORD) {

            final String className = getClassName(reader);

            if (className != null) {

              final Class<?> clazz;

              try            

      {                             clazz = Class.forName(className);                    return getForClass(clazz);             }

                catch (ClassNotFoundException e)

      {           return SpecificData.get();         }

            }

          }

       

      which seems then to seldom find the value inside the try and a lot of ClassNotFoundException is thrown.

      Throwing internal exceptions has great performance penalties and in practice users of avro 1.9.x. and 1.10.x in high performance applications are forced not to use builders.

       

      Information about same problem is also found on:

      https://forums.databricks.com/questions/50803/orgapacheavrospecificspecificdatagetforschema-sear.html

      Problem exists on at least 1.9.2 and 1.10.1 (but not on 1.7.x) in OSGI environment

      Attachments

        Issue Links

          Activity

            People

              unchuckable Martin Jubelgas
              Zackrisson Peter
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 50m
                  2h 50m