Effect CommunityEC
Effect Community2w ago
21 replies
sohai

[Effect + GraphQL Yoga] Per-request ManagedRuntime overhead

I've created a minimal reproduction of our GraphQL server architecture https://github.com/sohai/effect-yoga-repro

We're seeing ~20ms overhead per GraphQL request when using 16+ services. The overhead comes from creating a new ManagedRuntime with fresh layers for every request.

Why we need per-request runtime: DataLoader scope isolation and our ConnectRpcService reads RequestContext (accessToken, signal) when the layer is built, not when methods are called. The token gets captured in a closure. I tried couple of diffrent solution but my effect-ts knowlage is still limited and I cannot figurated out a better way, any suggestions much appreciated.
GitHub
Contribute to sohai/effect-yoga-repro development by creating an account on GitHub.
GitHub - sohai/effect-yoga-repro
Was this page helpful?