ankrgyl commented on PR #542:
URL:
https://github.com/apache/arrow-rs-object-store/pull/542#issuecomment-3517666478
> Also looking at the code, you roughly have something like this:
>
> ```
> if token_fresh() {
> return token;
> }
>
> let _guard = refresh.lock().await;
>
> ...
>
> write_token();
> ```
>
> I don't see how an `ArcSwap` is really gonna help here. In fact with that
construct the `RwLock` doesn't even need to be a tokio async lock. You can just
use a stdlib or parking_lot `RwLock` since getting the fresh token doesn't
involve I/O and replacing it while being under the refresh guard at the very
end is also just a sync write operation. My suspicion is that that would be
even faster, since async locks also have some overhead that we technically
don't need here.
Correct. I explicitly did not test any credential refreshes and just wanted
to illustrate the difference with read contention. It's not very hard to fill
that in.
And yes I stated above that this benchmark does not illustrate the
difference as extremely as what I saw in production. Perhaps it's because in a
real workload, we're doing a lot more on the runtime than just GET operations,
and that accentuates the impact of additional polls.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]