Skip to content

Fix Fleet server performance bottlenecks due to JSON unmarshal #25512

@getvictor

Description

@getvictor

Problem: The Go json/v1 API we are using is at least 2X slower at unmarshaling than pretty much any other library. We do a lot of JSON unmarshaling between osquery results, vulnerability processing, etc.

  • json/v2 realistically won't be out for at least a year. We could use it as is, but its API is unstable.
  • I recommend we try https://github.com/goccy/go-json to speed up JSON unmarshal where needed. It is popular (used by 177K open source repos) and API-compatible with json/v1. Once json/v2 is out, we can start using that.

Example performance issue: #24390

Another example from an old vuln processing pprof run:
image.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    ~backendBackend-related issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions