Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
DaMandal0rian opened this issue Oct 17, 2024 · 0 comments
Open
2 tasks done
Labels
enhancement New feature or request performance

Comments

@DaMandal0rian
Copy link
Contributor

DaMandal0rian commented Oct 17, 2024

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.
@DaMandal0rian DaMandal0rian added enhancement New feature or request performance labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

No branches or pull requests

2 participants
@DaMandal0rian and others