Skip to content
  • Klaus Post's avatar
    Reduce JWT overhead for internode tokens (#13738) · 142c6b11
    Klaus Post authored
    Since JWT tokens remain valid for up to 15 minutes, we 
    don't have to regenerate tokens for every call.
    
    Cache tokens for matching access+secret+audience 
    for up to 15 seconds.
    
    ```
    BenchmarkAuthenticateNode/uncached-32         	  270567	      4179 ns/op	    2961 B/op	      33 allocs/op
    BenchmarkAuthenticateNode/cached-32           	 7684824	       157.5 ns/op	      48 B/op	       1 allocs/op
    ```
    
    Reduces internode call allocations a great deal.
    142c6b11