Skip to content

RFC: Add Support for Symfony JsonStreamerΒ #216

@GaryPEGEOT

Description

@GaryPEGEOT

Summary

This RFC proposes adding support for Symfony's new JsonStreamer component as an alternative serialization strategy in Elastically. The JsonStreamer component, introduced in Symfony 7.3, provides significantly faster JSON encoding compared to the traditional Serializer component, which is pretty useful when dealing with large volumes of documents during bulk indexation operations.

Pros:

Serialization is significantly faster with JsonStreamer (up to 10x faster on a real life project)

Cons:

  • Component is exprimental, so no BC promise
  • Add a bit more complexity as component need to decide which Serializer to use

Proposed Solution

Design Principles

  1. Backward compatible: Existing code continues to work without changes
  2. Opt-in: Users explicitly enable JsonStreamer with attribute
  3. Coexistence: Both Serializer and JsonStreamer can be used simultaneously for different indexes
  4. Simple migration path: Minimal changes required to adopt JsonStreamer

Implementation Overview

The easiest way would be to check for #[JsonStreamable] attribute (and cache supports per class) and use JsonStreamer when present, or regular serializer otherwise.

πŸ‘πŸ» or πŸ‘ŽπŸ» ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions