Skip to content

Deduplicate token serialization #3407

@cthulhu-rider

Description

@cthulhu-rider

#3369 (comment)

Is your feature request related to a problem? Please describe.

full bearer/session token BLOB is a concatenation of 2 fields:

  1. body
  2. signature

currently, SN calculates it twice per-request:

  1. to access token cache
  2. to check the signature

body participates in both cases, but encoded twice

Describe the solution you'd like

marshal token once and reuse

Describe alternatives you've considered

originally, token comes in a binary format over gRPC. Then it's decoded to generated proto struct instance by gRPC lib functions, then we encode it again. So, we have extra decode-to-encode round. The best way would be:

  1. take token BLOB
  2. check everything needed with it
  3. decode

this is the most efficient approach. At the same time, it is quite challenging according to the API of used gRPC lib. This improvement is not limited to tokens and can be extended to many other cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    I4No visible changesS4RoutineU4Nothing urgentenhancementImproving existing functionalityhelp wantedExtra attention is neededneofs-storageStorage node application issuesperformanceMore of something per second

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions