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

Make use of the sun.misc.Unsafe class during serialization if a JDK supports it

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7.4
    • Fix Version/s: 1.7.5, 1.8.0
    • Component/s: java
    • Labels:
      None

      Description

      Unsafe can be used to significantly speed up serialization process, if a JDK implementation supports java.misc.Unsafe properly. Most JDKs running on PCs support it. Some platforms like Android lack a proper support for Unsafe yet.

      There are two possibilities to use Unsafe for serialization:
      1) Very quick access to the fields of objects. It is way faster than with the reflection-based approach using Field.get/set

      2) Input and Output streams can be using Unsafe to perform very quick input/output.

      3) More over, Unsafe makes it possible to serialize to/deserialize from off-heap memory directly and very quickly, without any intermediate buffers allocated on heap. There is virtually no overhead compared to the usual byte arrays.

        Attachments

        1. AVRO-1282-s1.patch
          63 kB
          Scott Carey
        2. AVRO-1282-s2.patch
          63 kB
          Scott Carey
        3. AVRO-1282-s3.patch
          66 kB
          Scott Carey
        4. AVRO-1282-s5.patch
          75 kB
          Scott Carey
        5. AVRO-1282-s6.patch
          88 kB
          Scott Carey
        6. AVRO-1282-s7.patch
          88 kB
          Scott Carey
        7. avro-1282-v1.patch
          33 kB
          Leo Romanoff
        8. avro-1282-v2.patch
          34 kB
          Leo Romanoff
        9. avro-1282-v3.patch
          29 kB
          Leo Romanoff
        10. avro-1282-v4.patch
          46 kB
          Leo Romanoff
        11. avro-1282-v5.patch
          47 kB
          Leo Romanoff
        12. avro-1282-v6.patch
          48 kB
          Leo Romanoff
        13. avro-1282-v7.patch
          45 kB
          Leo Romanoff
        14. avro-1282-v8.patch
          59 kB
          Leo Romanoff
        15. AVRO-1282-v9.patch
          78 kB
          Leo Romanoff
        16. TestUnsafeUtil.java
          2 kB
          Scott Carey

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                romixlev Leo Romanoff
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: