Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-14528

Leverage Jackson non-blocking JSON parsing (and remove netty-buffer dependency)

    Details

    • Type: Refactoring
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 5.0 M1
    • Fix Version/s: 5.0 RC3
    • Component/s: Reactive, Web
    • Labels:
      None
    • Last commented by a User:
      false

      Issue Links

        Activity

        Hide
        sdeleuze Sébastien Deleuze added a comment -

        Arjen Poutsma Rossen Stoyanchev I have created an updated JsonObjectDecoder based on our DataBuffer instead of using Netty ByteBuf, see this branch for the code. This is the first working version, and the implementation still needs some polish and managing properly buffer release/retain, but I think this is a good basis for discussing various points.

        Please notice that I fixed a bug in NettyDataBuffer#lastIndexOf() to make it works.

        This JsonObjectDecoder implementation aggregates the multiple buffers thanks to DataBuffer#write(DataBuffer), creates a slice in order to identify the JSON objects start and end index without changing the original buffer read position, and then return each JSON object as a slice that will be processed by Jackson2JsonDecoder.

        I think I need Arjen Poutsma feedback to understand how to manage release/retain in that use cases, where we use slices and where 2 decoders are processing the data together.

        Show
        sdeleuze Sébastien Deleuze added a comment - Arjen Poutsma Rossen Stoyanchev I have created an updated JsonObjectDecoder based on our DataBuffer instead of using Netty ByteBuf , see this branch for the code. This is the first working version, and the implementation still needs some polish and managing properly buffer release/retain, but I think this is a good basis for discussing various points. Please notice that I fixed a bug in NettyDataBuffer#lastIndexOf() to make it works. This JsonObjectDecoder implementation aggregates the multiple buffers thanks to DataBuffer#write(DataBuffer) , creates a slice in order to identify the JSON objects start and end index without changing the original buffer read position, and then return each JSON object as a slice that will be processed by Jackson2JsonDecoder . I think I need Arjen Poutsma feedback to understand how to manage release/retain in that use cases, where we use slices and where 2 decoders are processing the data together.
        Hide
        sdeleuze Sébastien Deleuze added a comment -

        Jackson 2.9 (initial release or a patch release coming shortly after) should provide asynchronous Jackson JSON parsing capabilities that will allow to avoid requiring io.netty.buffer dependency.

        Show
        sdeleuze Sébastien Deleuze added a comment - Jackson 2.9 (initial release or a patch release coming shortly after) should provide asynchronous Jackson JSON parsing capabilities that will allow to avoid requiring io.netty.buffer dependency.
        Hide
        sdeleuze Sébastien Deleuze added a comment -

        This feature should be available in the upcoming Jackson 2.9.0.pr4.

        Show
        sdeleuze Sébastien Deleuze added a comment - This feature should be available in the upcoming Jackson 2.9.0.pr4 .
        Hide
        sdeleuze Sébastien Deleuze added a comment -

        We now use Jackson 2.9.0.pr4 which contains this non-blocking JSON feature.

        Arjen Poutsma Since you mention during last meeting that you want to have a look to this feature + you have the experience of implementing Aalto XML support, I assign you this issue. Feel free to assign back to me after your initial look if you don't have the time to handle it for RC3.

        Show
        sdeleuze Sébastien Deleuze added a comment - We now use Jackson 2.9.0.pr4 which contains this non-blocking JSON feature. Arjen Poutsma Since you mention during last meeting that you want to have a look to this feature + you have the experience of implementing Aalto XML support, I assign you this issue. Feel free to assign back to me after your initial look if you don't have the time to handle it for RC3.
        Show
        arjen.poutsma Arjen Poutsma added a comment - Completed in https://github.com/spring-projects/spring-framework/commit/31e0e537500c0763a36d3af2570d5c253a374690
        Hide
        snicoll Stéphane Nicoll added a comment -

        That commit added an import on org.eclipse.jetty.io.RuntimeIOException

        Show
        snicoll Stéphane Nicoll added a comment - That commit added an import on org.eclipse.jetty.io.RuntimeIOException
        Show
        snicoll Stéphane Nicoll added a comment - Polished in https://github.com/spring-projects/spring-framework/commit/b1f06fddd2444b597730dd9911677b1adf87d410

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            rstoya05-aop Rossen Stoyanchev
            Last updater:
            Stéphane Nicoll
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              28 weeks, 6 days ago