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

server: http extensions are cloned for every rpc call #1391

Open
niklasad1 opened this issue Jun 5, 2024 · 0 comments
Open

server: http extensions are cloned for every rpc call #1391

niklasad1 opened this issue Jun 5, 2024 · 0 comments

Comments

@niklasad1
Copy link
Member

niklasad1 commented Jun 5, 2024

The HTTP extensions are fetched from the origin HTTP request and passed in the rpc middleware layers and rpc handler which is cloned for every rpc call.

HTTP request -> connect -> extensions.clone() -> rpc middleware -> rpc service -> response

Ideally we would wrap the extensions in an Arc/Mutex so the extensions could be shared without cloning but
because middleware layer can modify the extensions and such side-effects shouldn't impact future calls.

For instance if the state is shared then future rpc calls will inherit the state from past rpc calls which we don't want.

Cloning the http extensions comes with an overhead roughly 16 bytes by default but if users
put lots of data in the http extensions it could impact performance and memory usage significantly

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

No branches or pull requests

1 participant