-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NewClient
performance issues?
#36
Comments
For context, our standard use case in ESC involves a request like this: values:
op:
login:
serviceAccountToken: ...
alpha:
fn::open::1password-secrets:
login: ${op.login}
get:
secret-one: op://...
...
secret-n: op://...
...
omega:
fn::open::1password-secrets:
login: ${op.login}
get:
secret-one: op://...
...
secret-n: op://... For each values:
op:
login:
fn::open::1password-login:
serviceAccountToken: ...
alpha:
fn::open::1password-secrets:
login: ${op.login}
get:
secret-one: op://...
...
secret-n: op://...
...
omega:
fn::open::1password-secrets:
login: ${op.login}
get:
secret-one: op://...
...
secret-n: op://... In this case, |
@pgavlin Thanks for raising this issue and for taking the time to benchmark the SDK!
I understand how the longer execution time of the Interestingly I also ran a couple of benchmarks on my local device and in my case, most of the time (>75%) was spent making HTTP requests. But of course this depends on the device the SDK is run on and on its network connection. Seeing your results definitely makes me curious to investigate how the speed of the SDK could be improved!
This can be done by the caller of the SDK, by holding onto an instance of Caching the auth info "inside" of the SDK is an interesting idea, but it does raise some challenges around security and keeping sensitive information in memory for longer than necessary (or longer than the user of the SDK expected). Therefore this will require further consideration on our end and will likely not be added to the SDK unless it is necessary for specific use-cases. So let me know if it is a requirement for you or if you can achieve the same result by caching instances of |
we can, but it's a bit inconvenient. we'll need to keep a cache from service account token to client and be very, very certain that the cache is not accessible to multiple tenants.
I was thinking of something like this: // create a JSON-serializable credential bundle. perform initial auth, etc. here
creds, _ := op.Login()
// create a client from the credential bundle
client := op.NewClient(creds) so the caching isn't inside the SDK--it's under the control of the user. doesn't the OP CLI perform some sort of credential caching? |
I'm trying to understand you use-case a bit better. Could you clarify why caching the credential bundle would be easier than caching the SDK's client instance? I believe you would still need to implement the same kind of access control (to "be very, very certain that the cache is not accessible to multiple tenants"). Is it just because the credential bundle from your example would be serializable? |
Benchmark code:
Local results for 100x iterations:
Local results for 1x iteration:
Tracing the HTTP traffic for the last set of benchmark results shows the following calls on the
NewClient
path:It would be nice to have a way to cache the auth info if possible so that it can be shared between
NewClient
invocations.It's also a bit concerning that the HTTP traffic adds up to < 400ms while
NewClient
takes 1.3s to execute. Unfortunately, the CPU profile is opaque due to the compiled WASM, so it is unclear what is happening during the other 900ms. Note that the benchmarks warm the WASM runtime by callingNewClient
once prior to the actual benchmark.The text was updated successfully, but these errors were encountered: