Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5307

Address low hanging fruit in performance benchmarks

    XMLWordPrintableJSON

Details

    • Icon: Epic Epic
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • Performance
    • None
    • 0
    • 0
    • 0
    • 100

    Description

      We should take a close look at the driver's performance benchmark results and look for opportunities to improve. As an example, some of the things observed while running the large doc bulk insert benchmark:

      • Use of java.util.Stack in BsonWriter implementations. All the methods of this class are synchronized, which is unnecessary in non-thread safe classes. Could use ArrayDeque instead.
      • Lots of calls to CodecRegistry#get in DocumentCodec#writeValue and {BsonDocumentCodec#writeValue}}. The implementation of this method in ProvidersCodecRegistry is not built for use in inner loops. Some caching within the Codec implementation could be useful here.
      • ByteBufferBsonOutput is great for minimizing heap use, but there is a performance cost of all the buffer management that it has to do in an inner loop. We can consider using a simpler implementation of OutputBuffer that trades off memory use for speed. For example, we could just cache 48MB buffers instead of power-of-two buffers.

      There are likely more opportunities available as well.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: