Skip to content

Refactor: Optimize proxy handling for improved performance#1

Open
asce4s wants to merge 1 commit intomainfrom
perf/optimize-proxy-handling
Open

Refactor: Optimize proxy handling for improved performance#1
asce4s wants to merge 1 commit intomainfrom
perf/optimize-proxy-handling

Conversation

@asce4s
Copy link
Copy Markdown
Owner

@asce4s asce4s commented Jun 16, 2025

This commit introduces two key performance improvements to the gateway:

  1. Reusable Reverse Proxies: Reverse proxy instances are now created once at server startup and reused for incoming requests. Previously, a new proxy instance was generated for each request, incurring significant overhead. This change modifies server initialization, request routing, and handler logic to use these persistent proxy instances.

  2. Configurable Debug Transport: The DebugTransport, which logs outgoing request details for debugging, is now optional. It can be enabled/disabled via a debugProxy flag in the global section of the configs/bff.yml configuration file. By default, debugProxy is set to false, meaning the standard, more performant http.DefaultTransport is used. Enabling DebugTransport has a considerable performance impact and should only be used for debugging.

These changes significantly reduce per-request overhead and allow for more fine-grained control over debugging features that impact performance. The README has also been updated to document the new debugProxy configuration.

This commit introduces two key performance improvements to the gateway:

1.  **Reusable Reverse Proxies**: Reverse proxy instances are now created once at server startup and reused for incoming requests. Previously, a new proxy instance was generated for each request, incurring significant overhead. This change modifies server initialization, request routing, and handler logic to use these persistent proxy instances.

2.  **Configurable Debug Transport**: The `DebugTransport`, which logs outgoing request details for debugging, is now optional. It can be enabled/disabled via a `debugProxy` flag in the `global` section of the `configs/bff.yml` configuration file. By default, `debugProxy` is set to `false`, meaning the standard, more performant `http.DefaultTransport` is used. Enabling `DebugTransport` has a considerable performance impact and should only be used for debugging.

These changes significantly reduce per-request overhead and allow for more fine-grained control over debugging features that impact performance. The README has also been updated to document the new `debugProxy` configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant