Skip to content

Conversation

@kevinGC
Copy link
Contributor

@kevinGC kevinGC commented Oct 8, 2025

This has been useful to me for quick testing to see whether changes are performant. Compared to other benchmarks in record_test, this:

  • Exercises TCP, which is more realistic than byte.Buffer
  • Runs the reader and writer in parallel rather than sequentually

Since it only runs locally, it can be run easily. For example:

$ go test -run="^$" -bench="BenchmarkTCP" ./credentials/alts/internal/conn
goos: linux
goarch: amd64
pkg: google.golang.org/grpc/credentials/alts/internal/conn
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkTCP/size=1_KiB-12                   100          10058898 ns/op                 0 Mbps         97.34 cpu-usec/op               97.34 sys-usec/op                0 usr-usec/op
BenchmarkTCP/size=4_KiB-12                   100          10069605 ns/op                 2.979 Mbps            146.2 cpu-usec/op               104.7 sys-usec/op                41.42 usr-usec/op
BenchmarkTCP/size=64_KiB-12                  100          10510067 ns/op                47.57 Mbps            1116 cpu-usec/op         859.7 sys-usec/op               256.7 usr-usec/op
BenchmarkTCP/size=512_KiB-12                 100          13707500 ns/op               291.8 Mbps             8167 cpu-usec/op        6872 sys-usec/op        1295 usr-usec/op
BenchmarkTCP/size=1_MiB-12                   100          17343824 ns/op               461.3 Mbps            16276 cpu-usec/op       13361 sys-usec/op        2915 usr-usec/op
BenchmarkTCP/size=4_MiB-12                    32          39019702 ns/op               820.1 Mbps            64387 cpu-usec/op       51945 sys-usec/op       12443 usr-usec/op
PASS
ok      google.golang.org/grpc/credentials/alts/internal/conn   7.487s

RELEASE NOTES: none

@codecov
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.87%. Comparing base (9ff80a7) to head (18751a6).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8636      +/-   ##
==========================================
- Coverage   81.96%   81.87%   -0.09%     
==========================================
  Files         415      416       +1     
  Lines       40694    40789      +95     
==========================================
+ Hits        33355    33397      +42     
- Misses       5950     6019      +69     
+ Partials     1389     1373      -16     

see 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars
Copy link
Contributor

easwars commented Oct 10, 2025

@gtcooke94 Could you please review this? Thanks.

@easwars easwars added Type: Testing Area: Auth Includes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc. labels Oct 10, 2025
@easwars easwars added this to the 1.77 Release milestone Oct 10, 2025
@gtcooke94
Copy link
Contributor

Just want to check, the purpose here is quick performance checks on ALTS internals?

@kevinGC
Copy link
Contributor Author

kevinGC commented Oct 13, 2025

Yep, just ALTS internals. This is helpful for benchmarking performance changes, and I've been using it for looking at throughput + memory allocation behavior. I find it useful, and it'd be a lot easier for me to have it upstreamed here. But no offense if the project would rather not add it -- I can live with that.

@gtcooke94 gtcooke94 requested a review from rockspore October 13, 2025 20:13
This has been useful to me for quick testing to see whether changes are
performant. Compared to other benchmarks in record_test, this:

- Exercises TCP, which is more realistic than byte.Buffer
- Runs the reader and writer in parallel rather than sequentually

Since it only runs locally, it can be run easily. For example:

```
$ go test -run="^$" -bench="BenchmarkTCP" ./credentials/alts/internal/conn
goos: linux
goarch: amd64
pkg: google.golang.org/grpc/credentials/alts/internal/conn
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkTCP/size=1_KiB-12                   100          10058898 ns/op                 0 Mbps         97.34 cpu-usec/op               97.34 sys-usec/op                0 usr-usec/op
BenchmarkTCP/size=4_KiB-12                   100          10069605 ns/op                 2.979 Mbps            146.2 cpu-usec/op               104.7 sys-usec/op                41.42 usr-usec/op
BenchmarkTCP/size=64_KiB-12                  100          10510067 ns/op                47.57 Mbps            1116 cpu-usec/op         859.7 sys-usec/op               256.7 usr-usec/op
BenchmarkTCP/size=512_KiB-12                 100          13707500 ns/op               291.8 Mbps             8167 cpu-usec/op        6872 sys-usec/op        1295 usr-usec/op
BenchmarkTCP/size=1_MiB-12                   100          17343824 ns/op               461.3 Mbps            16276 cpu-usec/op       13361 sys-usec/op        2915 usr-usec/op
BenchmarkTCP/size=4_MiB-12                    32          39019702 ns/op               820.1 Mbps            64387 cpu-usec/op       51945 sys-usec/op       12443 usr-usec/op
PASS
ok      google.golang.org/grpc/credentials/alts/internal/conn   7.487s
```
@easwars
Copy link
Contributor

easwars commented Oct 16, 2025

@gtcooke94 : Looks like this is good for another pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Auth Includes regular credentials API and implementation. Also includes advancedtls, authz, rbac etc. Type: Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants