-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
I've noticed that the @google-cloud/spanner
library is consistently noticeably slower in Deno than in Node, at least when used outside of the GCP region where Spanner is run (as we do in local development and in CI).
Example repo: https://github.com/Macil/deno-spanner-performance-testing
This repo does six light SELECT 1
Spanner queries in a row and times each of them.
Deno output:
query-1: 909ms
query-2: 131ms
query-3: 140ms
query-4: 137ms
query-5: 135ms
query-6: 143ms
Node output:
query-1: 1.079s
query-2: 88.996ms
query-3: 88.856ms
query-4: 94.117ms
query-5: 87.084ms
query-6: 85.664ms
Average (ignoring first request) | |
---|---|
Node | 89ms |
Deno | 137ms (+54%) |
This is on my local machine with a 25ms ping to GCP us-west2 where the Spanner database is. I haven't compared with Node inside of GCP us-west2, but our Deno process running inside GCP us-west2 often has queries run in 20ms, so the impact of this issue seems less there.
I'm suspicious that somehow an extra network roundtrip is happening (and so this problem scales with ping time). I know that the Spanner library uses gRPC which uses HTTP/2-specific features and has other problems under Deno, so I assume this issue has something to do with Deno's implementation of the node:http2
API.
Related issues:
- @grpc/grpc-js 1.13.0 can not make connections; all GCP client libraries broken #28566. I'm pinning old versions of
@google-cloud/spanner
and@grpc/grpc-js
to work around this issue. (In Node, these old versions seem to perform as well as the current versions.)
Version: Deno 2.5.4