New issue
Advanced search Search tips

Issue 781978 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Gracefully handle memcache outages in token cache

Project Member Reported by vadimsh@chromium.org, Nov 6 2017

Issue description

luci-go GAE runtime caches various tokens (delegation tokens, OAuth actor tokens) in memcache.

Currently a memcache outages causes full outage of the code that relies on delegation token (e.g Milo) or OAuth actor tokens (e.g. tsmon flush).

Instead, when memcache is down, the token cache should degrade to either skipping the cache completely, or maybe using datastore as the cache.

It's also a good idea to put an in-process caching layer on top of memcache, so when memcache is down, we still have some caching (even if it's not global any more).
 
I'll use this bug as opportunity to cleanup some tech debt in luci-go's caching layer.
There isn't much debt to cleanup. I forgot that Dan already removed proccache package. The only thing is directly related to this bug: server/auth.Cache thing is now mostly unnecessary and server/auth package should just use server/caching package directly.
Project Member

Comment 3 by bugdroid1@chromium.org, Nov 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/42d10b8ffc175f34ff562a2dc6d2efbc1b1cacc9

commit 42d10b8ffc175f34ff562a2dc6d2efbc1b1cacc9
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Tue Nov 07 01:12:24 2017

caching: Make WithRequestCache always install unbound LRU cache.

We never used bound cache there and unlikely ever will. It makes API a tiny bit
simpler.

R=nodir@chromium.org
BUG= 781978 

Change-Id: Ie52aaea0ba725618e040420d2cf90ab6b6398e30
Reviewed-on: https://chromium-review.googlesource.com/756197
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[modify] https://crrev.com/42d10b8ffc175f34ff562a2dc6d2efbc1b1cacc9/appengine/gaeauth/server/cache_test.go
[modify] https://crrev.com/42d10b8ffc175f34ff562a2dc6d2efbc1b1cacc9/appengine/gaemiddleware/context.go
[modify] https://crrev.com/42d10b8ffc175f34ff562a2dc6d2efbc1b1cacc9/server/caching/context.go

Project Member

Comment 4 by bugdroid1@chromium.org, Nov 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/1d17d320271e03f14ce64792e15b9d12b7730f39

commit 1d17d320271e03f14ce64792e15b9d12b7730f39
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Tue Nov 07 01:35:14 2017

caching: Simplify auth.Cache interface by removing mutexpool from it.

The eventual goal is to delete auth.Cache completely and make auth library
use server/caching interfaces directly. They don't have mutexpools built-in.

R=nodir@chromium.org, iannucci@chromium.org
BUG= 781978 

Change-Id: If8512892d423fa00cd576f53add6bd2d450e2f15
Reviewed-on: https://chromium-review.googlesource.com/756095
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[modify] https://crrev.com/1d17d320271e03f14ce64792e15b9d12b7730f39/appengine/gaeauth/server/cache.go
[modify] https://crrev.com/1d17d320271e03f14ce64792e15b9d12b7730f39/server/auth/cache.go
[modify] https://crrev.com/1d17d320271e03f14ce64792e15b9d12b7730f39/server/auth/config.go
[modify] https://crrev.com/1d17d320271e03f14ce64792e15b9d12b7730f39/server/auth/oauth.go

Project Member

Comment 5 by bugdroid1@chromium.org, Nov 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/cca232833532f09634888996b73582691fda470c

commit cca232833532f09634888996b73582691fda470c
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Tue Nov 07 01:49:34 2017

caching: Make RequestCache always available.

Half of API users (one of the two...) already assumed it is. It is basically
free, so no need to complicate API by allowing it be missing.

Also split up caching/context.go into a bunch of files in preparation for
adding more stuff there.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I7947394c00aaccea2fb0269192affba9d8c490ff
Reviewed-on: https://chromium-review.googlesource.com/756326
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[modify] https://crrev.com/cca232833532f09634888996b73582691fda470c/appengine/gaeauth/server/cache.go
[modify] https://crrev.com/cca232833532f09634888996b73582691fda470c/appengine/gaeauth/server/cache_test.go
[delete] https://crrev.com/1d17d320271e03f14ce64792e15b9d12b7730f39/server/caching/context.go
[add] https://crrev.com/cca232833532f09634888996b73582691fda470c/server/caching/doc.go
[add] https://crrev.com/cca232833532f09634888996b73582691fda470c/server/caching/process.go
[add] https://crrev.com/cca232833532f09634888996b73582691fda470c/server/caching/request.go

Project Member

Comment 6 by bugdroid1@chromium.org, Nov 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/0d275c081ff2f7c98822d4cde48e468e10b11f08

commit 0d275c081ff2f7c98822d4cde48e468e10b11f08
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Tue Nov 07 23:29:28 2017

caching: Fix mutexpool usage in auth config.

The change in https://chromium.googlesource.com/infra/luci/luci-go/+/1d17d320271
is bad, it makes each request have its own mutexpool, since mutexpool instances
are not "anchored" somewhere among the global variables but instead created
each time ModifyConfig is called.

This CL fixes this by moving mutexpool to the globalAuthConfig vars that hold
the global auth stuff.

R=nodir@chromium.org
BUG= 781978 

Change-Id: Ifd20c420c2368ba00f5f85b837e59f853215561b
Reviewed-on: https://chromium-review.googlesource.com/757469
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/appengine/gaemiddleware/flex/env.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/appengine/gaemiddleware/standard/env.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/logdog/server/service/service.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/server/auth/auth_test.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/server/auth/cache.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/server/auth/config.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/server/auth/handlers_test.go
[modify] https://crrev.com/0d275c081ff2f7c98822d4cde48e468e10b11f08/server/auth/oauth.go

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/0517218aca910d4e15d0477b7700e7d2e1d6d06d

commit 0517218aca910d4e15d0477b7700e7d2e1d6d06d
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Thu Nov 09 23:05:41 2017

Introduce a place where GAE middleware can initialize globals after init().

This will be needed by new process cache implementation that uses init() time
to register various caches. GAE middleware package thus can't use init() to
instantiate the global cache (since it's still being built!). We workaround it
by adding this post-init hook.

The cost is one atomic read per request. Considering how much stuff already
happens in our root middlewares, the impact is negligible.

R=iannucci@chromium.org
BUG= 781978 

Change-Id: Ife94d7dea3b4729c86cf363bcca8e4e688dc4c90
Reviewed-on: https://chromium-review.googlesource.com/759333
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/0517218aca910d4e15d0477b7700e7d2e1d6d06d/appengine/gaemiddleware/context.go
[modify] https://crrev.com/0517218aca910d4e15d0477b7700e7d2e1d6d06d/appengine/gaemiddleware/flex/env.go
[modify] https://crrev.com/0517218aca910d4e15d0477b7700e7d2e1d6d06d/appengine/gaemiddleware/standard/env.go

Project Member

Comment 8 by bugdroid1@chromium.org, Nov 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/2d8c1698cdaf0ecb8de791ea55a710bd649131f3

commit 2d8c1698cdaf0ecb8de791ea55a710bd649131f3
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Fri Nov 10 22:39:57 2017

Refactor lazyslot.Slot API and implementation to be simpler.

This is in preparation for integrating lazyslot with process caching package
to simplify various singletons.

API changes:
  * Let callers pass the fetcher callback in Get(...) instead of initializing it
    once when constructing lazyslot.Slot. This actually simplifies the code,
    since the callback now is located closer to the place where its output is
    used.
  * Get rid of lazyslot.Value struct and just pass expiration duration directly.
    This simplifies writing fetch callbacks since they no longer need
    to instantiate this adhoc structure (nor know about its existence).
  * Stop returning expiration time from Get(...). No one uses it.
  * Allow returning zero expiration duration to indicate "doesn't expire",
    to be compatible with LRU.GetOrCreate API.

The implementation was refactored to (hopefully) look less confusing.

R=nodir@chromium.org
BUG= 781978 

Change-Id: If23fbce4a2d896c95f4e0c7496cb032101287cfe
Reviewed-on: https://chromium-review.googlesource.com/762850
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/appengine/gaesettings/gaesettings.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/appengine/gaesettings/gaesettings_test.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/common/data/caching/lazyslot/lazyslot.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/common/data/caching/lazyslot/lazyslot_test.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/server/auth/authdb/cache.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/server/auth/authdb/snapshot.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/server/settings/memory.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/server/settings/settings.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/tokenserver/appengine/impl/certchecker/certchecker.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/tokenserver/appengine/impl/certconfig/ca.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/tokenserver/appengine/impl/certconfig/crl.go
[modify] https://crrev.com/2d8c1698cdaf0ecb8de791ea55a710bd649131f3/tokenserver/appengine/impl/utils/policy/policy.go

Project Member

Comment 9 by bugdroid1@chromium.org, Nov 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/d69dd3378bbca3f800c68a2795ff12b40d28fbd0

commit d69dd3378bbca3f800c68a2795ff12b40d28fbd0
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Fri Nov 10 22:56:27 2017

caching: Split ProcessCache into per-application caches.

That way subsystems don't evict each other's data.

R=nodir@chromium.org, iannucci@chromium.org
BUG= 781978 

Change-Id: Ie404e78392d5b874bc25f2b4aafbd9f169e3dcdc
Reviewed-on: https://chromium-review.googlesource.com/756158
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaeauth/client/client.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaeauth/client/client_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaeauth/server/gaesigner/signer.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaemiddleware/context.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaemiddleware/flex/env.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaesecrets/gaesecrets.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaesecrets/gaesecrets_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/appengine/gaetesting/middleware.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/appengine/coordinator/coordinatorTest/context.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/appengine/coordinator/flex/storage_cache.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/appengine/coordinator/flex/storage_cache_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/server/service/config/cache.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/server/service/config/opts.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/logdog/server/service/service.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/luci_config/appengine/gaeconfig/default.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/luci_config/appengine/gaeconfig/default_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/milo/buildsource/buildbot/build_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/milo/common/config.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/authdb/snapshot_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/handlers_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/openid/method_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/openid/protocol.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/service/service_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/signing/certs.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/signing/certs_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/signing/info.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/auth/signing/info_test.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/server/caching/process.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/tokenserver/appengine/impl/certchecker/certchecker.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/tokenserver/appengine/impl/certconfig/ca.go
[modify] https://crrev.com/d69dd3378bbca3f800c68a2795ff12b40d28fbd0/tokenserver/appengine/impl/certconfig/ca_test.go

Project Member

Comment 10 by bugdroid1@chromium.org, Nov 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/21109c099622fdd57f2ed0351f688cd900e3618e

commit 21109c099622fdd57f2ed0351f688cd900e3618e
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Wed Nov 15 00:09:39 2017

caching: Add caching.GlobalCache(...) for basic memcache functionality.

Intended to be used by low-level libraries (like 'auth') that do not directly
depend on GAE. If libraries need a fancier API, then can link to luci/gae
directly.

This will eventually replace appengine/gaeauth/server/cache.go.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I57d331ad76405a510ca84a9ce7be2b638aba268a
Reviewed-on: https://chromium-review.googlesource.com/765022
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[add] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/appengine/gaemiddleware/cache.go
[add] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/appengine/gaemiddleware/cache_test.go
[modify] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/appengine/gaemiddleware/context.go
[modify] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/appengine/gaemiddleware/flex/env.go
[modify] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/appengine/gaemiddleware/standard/env.go
[add] https://crrev.com/21109c099622fdd57f2ed0351f688cd900e3618e/server/caching/global.go

Project Member

Comment 11 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/d1d55649592c8bfd5fa8c76f6fecdcb5165c6bb0

commit d1d55649592c8bfd5fa8c76f6fecdcb5165c6bb0
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Thu Nov 16 01:47:06 2017

[caching] Add simple 2-layer cache.

It will be used for auth tokens.

The first layer is LRU process cache, the second layer is the global memcache.
If memcache is not available (e.g on Flex) or misbehaving, it is skipped.

R=nodir@chromium.org
BUG= 781978 

Change-Id: If4ad7e20054a5c538f536c8242447344df6f483d
Reviewed-on: https://chromium-review.googlesource.com/770495
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[add] https://crrev.com/d1d55649592c8bfd5fa8c76f6fecdcb5165c6bb0/server/caching/layered/layered.go
[add] https://crrev.com/d1d55649592c8bfd5fa8c76f6fecdcb5165c6bb0/server/caching/layered/layered_test.go

Project Member

Comment 12 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/c74700528432cb82db4703a16e44e91861101cb0

commit c74700528432cb82db4703a16e44e91861101cb0
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Thu Nov 16 19:37:07 2017

[caching] Add 'cachingtest' package with a mock for GlobalCache.

Turns out it is useful in a bunch of different unit tests.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I02eb0d6c8943acf84175ffcd3dcaf3c03729279f
Reviewed-on: https://chromium-review.googlesource.com/773822
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[add] https://crrev.com/c74700528432cb82db4703a16e44e91861101cb0/server/caching/cachingtest/blobcache.go
[add] https://crrev.com/c74700528432cb82db4703a16e44e91861101cb0/server/caching/cachingtest/blobcache_test.go
[modify] https://crrev.com/c74700528432cb82db4703a16e44e91861101cb0/server/caching/layered/layered_test.go

Project Member

Comment 13 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/dea5491c37da46f51c3fc100d9fceb9fcaab9c18

commit dea5491c37da46f51c3fc100d9fceb9fcaab9c18
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Thu Nov 16 20:04:37 2017

[auth] Use 2-layered cache for OAuth token checks.

This is first step towards removing auth.Cache.

Also cache negative responses as well, since curiously most of the traffic that
hits this code has bad tokens (luci-logdog requests to "logs" service).

This affects primarily LogDog (its Flex part), since it's the only place where
GoogleOAuth2Method is used in production.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I1e60463b3d35c563938fddedfc0a35ad31d37a60
Reviewed-on: https://chromium-review.googlesource.com/773632
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/dea5491c37da46f51c3fc100d9fceb9fcaab9c18/server/auth/oauth.go
[modify] https://crrev.com/dea5491c37da46f51c3fc100d9fceb9fcaab9c18/server/auth/oauth_test.go

Project Member

Comment 14 by bugdroid1@chromium.org, Dec 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/2de768bc6b972cea62fc5691d05c5957844f7112

commit 2de768bc6b972cea62fc5691d05c5957844f7112
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Fri Dec 01 00:53:49 2017

[gaemiddleware] Add a setting that purposefully breaks memcache.

Useful to test how apps survive memcache outages (which occasionally happen).

R=iannucci@chromium.org, nodir@chromium.org
BUG= 781945 ,  781978 

Change-Id: I78964892fc44a00efc028b4e0042f0fe19b46a30
Reviewed-on: https://chromium-review.googlesource.com/801984
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>

[modify] https://crrev.com/2de768bc6b972cea62fc5691d05c5957844f7112/appengine/gaemiddleware/context.go
[modify] https://crrev.com/2de768bc6b972cea62fc5691d05c5957844f7112/appengine/gaemiddleware/settings.go

Project Member

Comment 15 by bugdroid1@chromium.org, Dec 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/01cb3a80237d258f296538ecadf1e4bb8dfd6bb7

commit 01cb3a80237d258f296538ecadf1e4bb8dfd6bb7
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Sat Dec 02 01:57:15 2017

[cache] Teach layered cache new tricks needed by server/auth.

1. Callers can now request that an item lives longer than minTTL and the cache
   will go and refresh the item if the cached one doesn't satisfy this
   requirement.
2. Callers can also request randomized early expiration to avoid cache stampede
   when hot items expire.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I6eb4d78622e4bd775277eaf184579069a903b172
Reviewed-on: https://chromium-review.googlesource.com/804619
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[modify] https://crrev.com/01cb3a80237d258f296538ecadf1e4bb8dfd6bb7/server/caching/layered/layered.go
[modify] https://crrev.com/01cb3a80237d258f296538ecadf1e4bb8dfd6bb7/server/caching/layered/layered_test.go

Project Member

Comment 16 by bugdroid1@chromium.org, Dec 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/infra/luci/luci-go.git/+/447a999f3f67f58b0508822dd99d15fb12580641

commit 447a999f3f67f58b0508822dd99d15fb12580641
Author: Vadim Shtayura <vadimsh@chromium.org>
Date: Mon Dec 04 23:48:21 2017

[auth] Refactor token cache implementation to use layered.Cache.

It both simplifies it and makes it tolerate memcache outages.

R=nodir@chromium.org
BUG= 781978 

Change-Id: I5eaf5616e0d53a637a512766efc35481f53be5b3
Reviewed-on: https://chromium-review.googlesource.com/804683
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>

[delete] https://crrev.com/fbcd6e0de08a8f044ccb7dc0dec4c3f561766ed6/appengine/gaeauth/server/cache.go
[delete] https://crrev.com/fbcd6e0de08a8f044ccb7dc0dec4c3f561766ed6/appengine/gaeauth/server/cache_test.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/appengine/gaemiddleware/flex/env.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/appengine/gaemiddleware/standard/env.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/logdog/server/service/service.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/actor.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/actor_test.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/cache.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/cache_test.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/config.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/delegation.go
[modify] https://crrev.com/447a999f3f67f58b0508822dd99d15fb12580641/server/auth/delegation_test.go

Status: Fixed (was: Assigned)
Token cache code now will transparently fall back to using only local cache if memcache is not available.

It will still try to occasionally hit memcache, so if the RPC hangs (until 5 sec deadline we enforce on the client side), this will be somewhat noticeable. But in practice GAE memcache outages are usually simple: all RPCs just immediately fail with Not Available error. 

Sign in to add a comment