Skip to content

Conversation

odeke-em
Copy link
Contributor

@odeke-em odeke-em commented Oct 17, 2024

This requires you to add to your environment

    SPANNER_RUN_BENCHMARKS=true

and then it can be run by npm run observability-test whose results look like:

startTrace against 3 different scenarios

Total Runs:   20000
Warm up runs: 2500
withNullTracerProviderUnsetGlobalTracerProvider
	RAM (2.273kB)
	TimeSpent (12.171µs)
withTracerDefinedTracerProvider
	RAM (2.695kB)
	TimeSpent (14.074µs)
withTracerRegisteredGlobally
	RAM (2.727kB)
	TimeSpent (14.413µs)

Database runs against mockspanner

  Benchmarking Database
Total Runs:   20000
Warm up runs: 2500
databaseRunSelect1AsyncAwait
	RAM Untraced(209.906kB) vs Traced     (224.453kB): increase by (14.547kB) or 6.93%
	RAM Untraced(209.906kB) vs Traced+OTEL(243.211kB): increase by (33.305kB) or 15.87%
	Time Untraced(901.139µs) vs Traced     (918.845µs):  increase by (17.706µs) or 1.96%
	Time Untraced(901.139µs) vs Traced+OTEL(1.019ms):  increase by (118.223µs) or 13.12%

databaseRunSelect1Callback
	RAM Untraced(209.789kB) vs Traced     (224.641kB): increase by (14.852kB) or 7.08%
	RAM Untraced(209.789kB) vs Traced+OTEL(242.500kB): increase by (32.711kB) or 15.59%
	Time Untraced(902.862µs) vs Traced     (920.289µs):  increase by (17.427µs) or 1.93%
	Time Untraced(902.862µs) vs Traced+OTEL(1.027ms):  increase by (124.280µs) or 13.77%

databaseRunTransactionAsyncTxRunUpdate
	RAM Untraced(309.352kB) vs Traced     (323.734kB): increase by (14.383kB) or 4.65%
	RAM Untraced(309.352kB) vs Traced+OTEL(324.258kB): increase by (14.906kB) or 4.82%
	Time Untraced(1.508ms) vs Traced     (1.516ms):  increase by (7.340µs) or 0.49%
	Time Untraced(1.508ms) vs Traced+OTEL(1.679ms):  increase by (170.989µs) or 11.34%

databaseRunTransactionAsyncTxRun
	RAM Untraced(299.117kB) vs Traced     (311.320kB): increase by (12.203kB) or 4.08%
	RAM Untraced(299.117kB) vs Traced+OTEL(313.602kB): increase by (14.484kB) or 4.84%
	Time Untraced(1.460ms) vs Traced     (1.469ms):  increase by (8.468µs) or 0.58%
	Time Untraced(1.460ms) vs Traced+OTEL(1.679ms):  increase by (219.068µs) or 15.00%

from a quiet Linux machine

$ uname -a
Linux emmanuel-PowerEdge-T30 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/nodejs-spanner API. labels Oct 17, 2024
@odeke-em
Copy link
Contributor Author

Pushing up more updates in a couple @alkatrivedi @surbhigarg92, but this PR is currently a draft.

@odeke-em odeke-em force-pushed the observability-benchmarking branch from 8edd742 to f0eb7e5 Compare October 20, 2024 20:42
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Oct 20, 2024
@odeke-em odeke-em force-pushed the observability-benchmarking branch 4 times, most recently from d48777b to 90fb9d7 Compare October 24, 2024 09:52
This requires you to add to your environment

	SPANNER_RUN_BENCHMARKS=true

and then it can be run by npm run observability-test whose results look like:

```shell
  Benchmarking
Total Runs: 10000
databaseRunSelect1AsyncAwait
	RAM Untraced(206.453kB) vs Traced     (240.953kB): increase by (34.500kB) or 16.71%
	RAM Untraced(206.453kB) vs Traced+OTEL(243.391kB): increase by (36.938kB) or 17.89%
	Time Untraced(911.057µs) vs Traced     (1.014ms):  increase by (102.749µs) or 11.28%
	Time Untraced(911.057µs) vs Traced+OTEL(1.017ms):  increase by (106.116µs) or 11.65%

databaseRunSelect1Callback
	RAM Untraced(210.219kB) vs Traced     (238.797kB): increase by (28.578kB) or 13.59%
	RAM Untraced(210.219kB) vs Traced+OTEL(242.914kB): increase by (32.695kB) or 15.55%
	Time Untraced(890.877µs) vs Traced     (997.541µs):  increase by (106.664µs) or 11.97%
	Time Untraced(890.877µs) vs Traced+OTEL(1.019ms):  increase by (127.997µs) or 14.37%

databaseRunTransactionAsyncTxRunUpdate
	RAM Untraced(308.898kB) vs Traced     (325.313kB): increase by (16.414kB) or 5.31%
	RAM Untraced(308.898kB) vs Traced+OTEL(339.836kB): increase by (30.938kB) or 10.02%
	Time Untraced(1.510ms) vs Traced     (1.652ms):  increase by (141.330µs) or 9.36%
	Time Untraced(1.510ms) vs Traced+OTEL(1.668ms):  increase by (157.466µs) or 10.43%

databaseRunTransactionAsyncTxRun
	RAM Untraced(298.977kB) vs Traced     (326.227kB): increase by (27.250kB) or 9.11%
	RAM Untraced(298.977kB) vs Traced+OTEL(315.164kB): increase by (16.188kB) or 5.41%
	Time Untraced(1.450ms) vs Traced     (1.581ms):  increase by (130.870µs) or 9.03%
	Time Untraced(1.450ms) vs Traced+OTEL(1.615ms):  increase by (165.426µs) or 11.41%
```
@odeke-em odeke-em changed the title feat(observability): spin up benchmarking against the Spanner emulator feat(observability): spin up micro-benchmarking framework Oct 24, 2024
@odeke-em odeke-em marked this pull request as ready for review October 24, 2024 09:53
@odeke-em odeke-em requested review from a team as code owners October 24, 2024 09:53
@odeke-em odeke-em force-pushed the observability-benchmarking branch 2 times, most recently from 62ef9d8 to 2488550 Compare October 28, 2024 12:46
… other code too

We now have more isolated and more accurate values

```shell
  Benchmarking Database
Total Runs:   20000
Warm up runs: 2500
databaseRunSelect1AsyncAwait
	RAM Untraced(209.906kB) vs Traced     (224.453kB): increase by (14.547kB) or 6.93%
	RAM Untraced(209.906kB) vs Traced+OTEL(243.211kB): increase by (33.305kB) or 15.87%
	Time Untraced(901.139µs) vs Traced     (918.845µs):  increase by (17.706µs) or 1.96%
	Time Untraced(901.139µs) vs Traced+OTEL(1.019ms):  increase by (118.223µs) or 13.12%

databaseRunSelect1Callback
	RAM Untraced(209.789kB) vs Traced     (224.641kB): increase by (14.852kB) or 7.08%
	RAM Untraced(209.789kB) vs Traced+OTEL(242.500kB): increase by (32.711kB) or 15.59%
	Time Untraced(902.862µs) vs Traced     (920.289µs):  increase by (17.427µs) or 1.93%
	Time Untraced(902.862µs) vs Traced+OTEL(1.027ms):  increase by (124.280µs) or 13.77%

databaseRunTransactionAsyncTxRunUpdate
	RAM Untraced(309.352kB) vs Traced     (323.734kB): increase by (14.383kB) or 4.65%
	RAM Untraced(309.352kB) vs Traced+OTEL(324.258kB): increase by (14.906kB) or 4.82%
	Time Untraced(1.508ms) vs Traced     (1.516ms):  increase by (7.340µs) or 0.49%
	Time Untraced(1.508ms) vs Traced+OTEL(1.679ms):  increase by (170.989µs) or 11.34%

databaseRunTransactionAsyncTxRun
	RAM Untraced(299.117kB) vs Traced     (311.320kB): increase by (12.203kB) or 4.08%
	RAM Untraced(299.117kB) vs Traced+OTEL(313.602kB): increase by (14.484kB) or 4.84%
	Time Untraced(1.460ms) vs Traced     (1.469ms):  increase by (8.468µs) or 0.58%
	Time Untraced(1.460ms) vs Traced+OTEL(1.679ms):  increase by (219.068µs) or 15.00%

    ✔ Database runs compared (403854ms)

  Benchmark getTracer
tracerProvider
Total Runs:   20000
Warm up runs: 2500
withNullTracerProviderUnsetGlobalTracerProvider
	RAM (2.273kB)
	TimeSpent (12.171µs)
withTracerDefinedTracerProvider
	RAM (2.695kB)
	TimeSpent (14.074µs)
withTracerRegisteredGlobally
	RAM (2.727kB)
	TimeSpent (14.413µs)
```
@odeke-em odeke-em force-pushed the observability-benchmarking branch from 2488550 to 4d5c897 Compare October 28, 2024 12:56
@surbhigarg92 surbhigarg92 marked this pull request as draft June 6, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant