Skip to content

[Feature] Enable gzip compression on graph-node RPC JSON requests #5671

@DaMandal0rian

Description

@DaMandal0rian

Description

Feature Request: Enable Gzip Compression for RPC JSON Requests in Graph Node

Summary

I propose adding gzip compression support for RPC JSON requests in Graph Node. This feature would optimize network performance by reducing the size of RPC payloads, improving response times, and lowering bandwidth usage.

Motivation

Enabling gzip compression for JSON-RPC requests offers several benefits, as highlighted in Alchemy's guide:

  1. Reduced Bandwidth: Compressing large JSON payloads minimizes data transfer size, saving bandwidth.
  2. Faster Response Times: Smaller payloads lead to quicker responses, improving query speed and overall performance.
  3. Scalability: Efficient for high-volume requests and environments with limited network resources.
  4. Industry Standard: Aligns Graph Node with best practices seen in other blockchain infrastructures.

Feature Description

The feature would allow gzip compression for both incoming requests and outgoing responses in Graph Node. Compression would be applied when the client supports it (i.e., when the Accept-Encoding: gzip header is present) and configurable via Graph Node’s settings (default disabled for backward compatibility).

Implementation

  • Content Negotiation: Enable compression based on client support by checking the request headers.
  • Libraries: Use Rust compression libraries like flate2 or gzip.
  • Configurable: Add a configuration option to toggle gzip compression on or off.

Benefits

  • Performance: Faster query execution and reduced response times.
  • Efficiency: Lower bandwidth consumption, improving scalability.
  • Better User Experience: Reduced latency for applications interacting with Graph Node.

Drawbacks

  • CPU Overhead: Compression adds minor CPU load, but the trade-off with improved network efficiency justifies it. This can be controlled via configuration.

Conclusion

Gzip compression would improve Graph Node's performance and scalability, offering faster responses and reduced bandwidth, making it a valuable addition to RPC-heavy workloads.

Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

No response

Some information to help us out

  • Tick this box if you plan on implementing this feature yourself.
  • I have searched the issue tracker to make sure this issue is not a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions