-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: Attempt to warm http2 connection upon SDK startup #1201
Conversation
😎 Merged successfully - details. |
I tested Bun and it doesn't emit any events on the HTTP/2 stream. I spent the afternoon trying to dig into their source code and compare the |
Are we not supporting Next.js with this as well? |
Looking at our Next adapter, it uses
Node imports are forbidden in the edge runtime, so we'd need to implement near-duplicate files like we do for |
Ah yes, I remember. We definitely want to do this for Next.js as well - do you want to do that as a separate PR? |
#1221) This moves our transport logic into its own package. This allows us to leverage [conditional exports](https://nodejs.org/docs/latest-v18.x/api/packages.html#conditional-exports) to support `bun` and `edge-light` which need additional considerations for their transports. Right now, this package is very thin, as it just calls out to the correct Connect-RPC functions for the correct runtime, but we'll also be able to consolidate our HTTP/2 Session logic from #1201 and build our custom transport in a single place (in the future). During development, I added console.log statements to verify the correct `createTransport` was being called based on the runtime, but I don't want to thread the logger into here so I just removed them before submitting the PR.
faf4b2e
to
3faaa4d
Compare
@davidmytton this should be ready to review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I've tested Next.js on Vercel with edge middleware and serverless functions. Serverless functions show the expected behavior of the initial connection latency being the highest and then subsequent requests being much faster. There wasn't any improvement in the latency on the edge middleware - latency is the same for every request.
Automatically generated with [Release Please](https://github.com/googleapis/release-please). --- <details><summary>@arcjet/analyze: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/analyze-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/analyze:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/bun: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/bun-v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/env bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/headers bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/ip bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/logger bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/transport bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * arcjet bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/decorate: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/decorate-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/decorate:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/sprintf bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/duration: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/duration-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/duration:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/env: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/env-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/env:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/eslint-config: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/eslint-config-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/eslint-config:** Synchronize arcjet-js versions </details> <details><summary>@arcjet/headers: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/headers-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/headers:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/ip: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/ip-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/ip:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/logger: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/logger-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/logger:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/sprintf bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/next: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/next-v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/env bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/headers bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/ip bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/logger bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/transport bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * arcjet bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/node: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/node-v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/env bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/headers bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/ip bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/logger bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/transport bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * arcjet bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/protocol: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/protocol-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/protocol:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/rollup-config: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/rollup-config-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/rollup-config:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/runtime: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/runtime-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/runtime:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/sprintf: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/sprintf-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/sprintf:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/sveltekit: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/sveltekit-v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/env bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/headers bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/ip bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/logger bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/transport bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * arcjet bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/transport: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/transport-v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) * Attempt to warm http2 connection upon SDK startup ([#1201](#1201)) ([a5c2571](a5c2571)) ### Dependencies * The following workspace dependencies were updated * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>@arcjet/tsconfig: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](https://github.com/arcjet/arcjet-js/compare/v1.0.0-alpha.20...@arcjet/tsconfig-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **@arcjet/tsconfig:** Synchronize arcjet-js versions </details> <details><summary>arcjet: 1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](v1.0.0-alpha.20...arcjet-v1.0.0-alpha.21) (2024-08-05) ### 🧹 Miscellaneous Chores * **arcjet:** Synchronize arcjet-js versions ### Dependencies * The following workspace dependencies were updated * dependencies * @arcjet/analyze bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/duration bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/headers bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/protocol bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/runtime bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * devDependencies * @arcjet/eslint-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/rollup-config bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 * @arcjet/tsconfig bumped from 1.0.0-alpha.20 to 1.0.0-alpha.21 </details> <details><summary>1.0.0-alpha.21</summary> ## [1.0.0-alpha.21](v1.0.0-alpha.20...v1.0.0-alpha.21) (2024-08-05) ### 🚀 New Features * Abstract transports into package to leverage conditional exports ([#1221](#1221)) ([27776f7](27776f7)) * Attempt to warm http2 connection upon SDK startup ([#1201](#1201)) ([a5c2571](a5c2571)) ### 🧹 Miscellaneous Chores * **ci:** Change the dependabot commit prefix for Actions PRs ([#1231](#1231)) ([4dac6d5](4dac6d5)) * **ci:** Ignore typescript-eslint 8 until we upgrade to eslint 9 ([#1263](#1263)) ([b089de2](b089de2)), closes [#539](#539) * **ci:** Leverage Dependabot to update our GitHub Actions ([#1222](#1222)) ([ffde70a](ffde70a)) * **ci:** Switch release-please-action location & update to latest version ([#1229](#1229)) ([e44d81d](e44d81d)) * **deps:** bump actions/checkout from 3 to 4 ([#1226](#1226)) ([7d5242c](7d5242c)) * **deps:** bump step-security/harden-runner from 2.7.0 to 2.9.0 ([#1225](#1225)) ([76755e1](76755e1)) * **examples:** Ensure bun examples have updated dependencies ([#1213](#1213)) ([e766029](e766029)) * Remove Dependencies section from release notes ([#1211](#1211)) ([1708f6a](1708f6a)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This updates our HTTP2 transport to attempt the
connect()
of the HTTP2 connection upon initialization. It also sets a 600 second timeout on the connection.This most benefits long-running servers, but improvements can also be seen in warm serverless functions.