Skip to content

@google-cloud/spanner is 50% slower in Deno compared to Node #30984

@Macil

Description

@Macil

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:

Version: Deno 2.5.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions