Skip to content

Optimize token encoding#3778

Merged
roman-khimov merged 3 commits intomasterfrom
optimize-token-encoding
Jan 22, 2026
Merged

Optimize token encoding#3778
roman-khimov merged 3 commits intomasterfrom
optimize-token-encoding

Conversation

@cthulhu-rider
Copy link
Contributor

No description provided.

Body is a part of binary which is always calculated for cache lookup.
Also, body is used to verify token signature. Previously, service
allocated two token buffers per-request while body was present in both
of them. Now service uses only one buffer.

```
goos: linux
goarch: amd64
pkg: github.com/nspcc-dev/neofs-node/pkg/services/object/acl/v2
cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
                           │     old     │              new              │
                           │   sec/op    │   sec/op     vs base          │
SessionTokenVerification-8   83.14µ ± 0%   82.97µ ± 1%  ~ (p=0.315 n=10)

                           │     old      │                 new                  │
                           │     B/op     │     B/op      vs base                │
SessionTokenVerification-8   3.984Ki ± 0%   2.773Ki ± 0%  -30.39% (p=0.000 n=10)

                           │    old     │                new                 │
                           │ allocs/op  │ allocs/op   vs base                │
SessionTokenVerification-8   58.00 ± 0%   43.00 ± 0%  -25.86% (p=0.000 n=10)
```

Refs #3407.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Same as 4454d1d.

```
goos: linux
goarch: amd64
pkg: github.com/nspcc-dev/neofs-node/pkg/services/object/acl/v2
cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
                          │     old      │              new              │
                          │    sec/op    │   sec/op     vs base          │
BearerTokenVerification-8   83.56µ ± 14%   82.49µ ± 2%  ~ (p=1.000 n=10)

                          │     old      │                 new                  │
                          │     B/op     │     B/op      vs base                │
BearerTokenVerification-8   3.461Ki ± 0%   2.664Ki ± 0%  -23.02% (p=0.000 n=10)

                          │    old     │                new                 │
                          │ allocs/op  │ allocs/op   vs base                │
BearerTokenVerification-8   52.00 ± 0%   42.00 ± 0%  -19.23% (p=0.000 n=10)
```

Refs #3407.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Same as 4454d1d.

```
goos: linux
goarch: amd64
pkg: github.com/nspcc-dev/neofs-node/pkg/services/container
cpu: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
                           │     old      │                new                 │
                           │    sec/op    │   sec/op     vs base               │
SessionTokenVerification-8   87.69µ ± 12%   80.44µ ± 2%  -8.27% (p=0.001 n=10)

                           │     old      │                 new                  │
                           │     B/op     │     B/op      vs base                │
SessionTokenVerification-8   3.250Ki ± 0%   2.445Ki ± 0%  -24.76% (p=0.000 n=10)

                           │    old     │                new                 │
                           │ allocs/op  │ allocs/op   vs base                │
SessionTokenVerification-8   48.00 ± 0%   39.00 ± 0%  -18.75% (p=0.000 n=10)
```

Closes #3407.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@cthulhu-rider cthulhu-rider force-pushed the optimize-token-encoding branch from 1a73b55 to 7312bf4 Compare January 21, 2026 14:26
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 40.00000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.66%. Comparing base (4aff770) to head (7312bf4).
⚠️ Report is 12 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/object/acl/v2/service.go 40.90% 12 Missing and 1 partial ⚠️
internal/protobuf/protobuf.go 0.00% 12 Missing ⚠️
pkg/services/container/server.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3778      +/-   ##
==========================================
+ Coverage   25.64%   25.66%   +0.01%     
==========================================
  Files         657      658       +1     
  Lines       42129    42165      +36     
==========================================
+ Hits        10805    10822      +17     
- Misses      30344    30362      +18     
- Partials      980      981       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@cthulhu-rider cthulhu-rider marked this pull request as ready for review January 21, 2026 14:32
@roman-khimov roman-khimov merged commit 46c7227 into master Jan 22, 2026
19 of 22 checks passed
@roman-khimov roman-khimov deleted the optimize-token-encoding branch January 22, 2026 18:58
@End-rey End-rey mentioned this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants