Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Issue 1381583007: cipd: Implement local cache for ResolveVersion(...) call with tags. (Closed)

Created:
5 years, 2 months ago by Vadim Sh.
Modified:
5 years, 2 months ago
CC:
chromium-reviews, infra-reviews+infra_chromium.org
Base URL:
https://chromium.googlesource.com/infra/infra.git@cipd-init
Target Ref:
refs/heads/master
Project:
infra
Visibility:
Public.

Description

cipd: Implement local cache for ResolveVersion(...) call with tags. Tags are not detachable. If ResolveVersion(<tag>) resolved to something, it is guaranteed to resolve to the same thing later or not to resolve at all (in case same <tag> was attached to another instance). Tags that are applied to multiple instances aren't supposed to be used for version resolution anyway. So it seems acceptable to cache <tag> -> <instance id> mapping locally to avoid round trip to the server next time it is used. In practice same tag reresolution happens a lot. Puppet runs "cipd ensure" each N minutes, passing cipd "pkg1:tag1 pkg2:tag2 ..." list where tags are mostly static (compared to the frequency of puppet runs). No need to go to the backend all the time. Especially considering it might not be available due to temporary networks hiccups, etc. I expect this CL will reduce QPS to the backed to ~0 compared to the current state. R=nodir@chromium.org, tandrii@chromium.org BUG= Committed: https://chromium.googlesource.com/infra/infra/+/72d3a5a5d8173d0a353d26ce307b96270355c77f

Patch Set 1 #

Total comments: 56

Patch Set 2 : #

Patch Set 3 : add tests #

Patch Set 4 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+595 lines, -39 lines) Patch
M go/src/infra/tools/cipd/apps/cipd/friendly.go View 1 2 chunks +9 lines, -0 lines 0 comments Download
M go/src/infra/tools/cipd/apps/cipd/main.go View 1 2 3 9 chunks +9 lines, -0 lines 0 comments Download
M go/src/infra/tools/cipd/client.go View 1 2 3 8 chunks +142 lines, -35 lines 0 comments Download
A go/src/infra/tools/cipd/internal/checksum.go View 1 chunk +42 lines, -0 lines 0 comments Download
A go/src/infra/tools/cipd/internal/checksum_test.go View 1 2 1 chunk +45 lines, -0 lines 0 comments Download
A + go/src/infra/tools/cipd/internal/internal.infra_testing View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
A + go/src/infra/tools/cipd/internal/messages/generate.go View 1 chunk +4 lines, -4 lines 0 comments Download
A + go/src/infra/tools/cipd/internal/messages/messages.infra_testing View 1 2 0 chunks +-1 lines, --1 lines 0 comments Download
A go/src/infra/tools/cipd/internal/messages/messages.proto View 1 chunk +27 lines, -0 lines 0 comments Download
A go/src/infra/tools/cipd/internal/messages/messages.pb.go View 1 chunk +101 lines, -0 lines 0 comments Download
A go/src/infra/tools/cipd/internal/tagcache.go View 1 2 1 chunk +164 lines, -0 lines 0 comments Download
A go/src/infra/tools/cipd/internal/tagcache_test.go View 1 2 1 chunk +54 lines, -0 lines 0 comments Download
M go/src/infra/tools/cipd/local/fs.go View 1 chunk +0 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (3 generated)
Vadim Sh.
ptal tests are coming https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/messages/generate.go File go/src/infra/tools/cipd/internal/messages/generate.go (right): https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/messages/generate.go#newcode13 go/src/infra/tools/cipd/internal/messages/generate.go:13: var _ = proto.Marshal this ...
5 years, 2 months ago (2015-09-30 03:50:01 UTC) #1
tandrii(chromium)
inline comments + 2 general question: 1) why protobuf? aka why not readable json for ...
5 years, 2 months ago (2015-09-30 18:11:15 UTC) #2
nodir
main offenders: Save does not compact, ResolveTag iterates old entries first https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/client.go File go/src/infra/tools/cipd/client.go (right): ...
5 years, 2 months ago (2015-09-30 19:08:24 UTC) #3
Vadim Sh.
> 1) why protobuf? aka why not readable json for easier debuggability? reading 300 json ...
5 years, 2 months ago (2015-09-30 22:27:02 UTC) #4
tandrii_google
On 2015/09/30 22:27:02, Vadim Sh. wrote: > > 1) why protobuf? aka why not readable ...
5 years, 2 months ago (2015-09-30 22:34:22 UTC) #5
Vadim Sh.
https://chromiumcodereview.appspot.com/1381583007/diff/1/go/src/infra/tools/cipd/client.go File go/src/infra/tools/cipd/client.go (right): https://chromiumcodereview.appspot.com/1381583007/diff/1/go/src/infra/tools/cipd/client.go#newcode301 go/src/infra/tools/cipd/client.go:301: // doRequest lazy-initializes http.Client by calling giving callback and ...
5 years, 2 months ago (2015-09-30 22:50:59 UTC) #6
tandrii_google
https://chromiumcodereview.appspot.com/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go File go/src/infra/tools/cipd/internal/tagcache.go (right): https://chromiumcodereview.appspot.com/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go#newcode23 go/src/infra/tools/cipd/internal/tagcache.go:23: // multiple instances, in which case the tag is ...
5 years, 2 months ago (2015-09-30 23:11:00 UTC) #8
nodir
lgtm https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go File go/src/infra/tools/cipd/internal/tagcache.go (right): https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go#newcode23 go/src/infra/tools/cipd/internal/tagcache.go:23: // multiple instances, in which case the tag ...
5 years, 2 months ago (2015-10-01 23:24:04 UTC) #9
Vadim Sh.
https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go File go/src/infra/tools/cipd/internal/tagcache.go (right): https://codereview.chromium.org/1381583007/diff/1/go/src/infra/tools/cipd/internal/tagcache.go#newcode75 go/src/infra/tools/cipd/internal/tagcache.go:75: if err := UnmarshalWithSHA1(buf, &cache); err != nil { ...
5 years, 2 months ago (2015-10-01 23:34:07 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1381583007/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1381583007/60001
5 years, 2 months ago (2015-10-05 19:45:49 UTC) #13
commit-bot: I haz the power
5 years, 2 months ago (2015-10-05 19:48:25 UTC) #14
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/infra/infra/+/72d3a5a5d8173d0a353d26ce307b9...

Powered by Google App Engine
This is Rietveld 408576698