Skip to content

mixerfilter: add protobuf caching#11469

Closed
kyessenov wants to merge 4 commits intoistio:release-1.1from
kyessenov:mixer_filter_cache
Closed

mixerfilter: add protobuf caching#11469
kyessenov wants to merge 4 commits intoistio:release-1.1from
kyessenov:mixer_filter_cache

Conversation

@kyessenov
Copy link
Copy Markdown
Contributor

Supersedes #11137
Fixes #9800

/assign @mandarjog
/assign @douglas-reid

Signed-off-by: Kuat Yessenov kuat@google.com

Signed-off-by: Kuat Yessenov <kuat@google.com>
out := &cacheData{
serviceConfigAny: make(map[cacheKey]*types.Any),
}
// TODO: unclear whether this enumerates all services, including external?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All services in the service registry [k8s, service entries, etc.]

Copy link
Copy Markdown
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks okay.
Question: doesn't the mixer attributes encode the source UID or destination UID, which are specific to every pod? If that is not the case, then its actually far more easier to simply cache the LDS/RDS outputs right?

}
// TODO: unclear whether this enumerates all services, including external?
for _, service := range in.Push.ServiceByHostname {
for _, disable := range []bool{true, false} {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of looping through true and false and then inbound and outbound, why not just write four calls ?

for _, service := range in.Push.ServiceByHostname {
   // policy disabled
   out.serviceConfigAny[cacheKey{"inbound", true, ... }] = util.MessageToAny(...)
   out.serviceConfigAny[cacheKey{"outbound", true, ... }] = util.MessageToAny(...)

   // policy enabled
   out.serviceConfigAny[cacheKey{"inbound", false, ... }] = util.MessageToAny(...)
   out.serviceConfigAny[cacheKey{"outbound", false, ... }] = util.MessageToAny(...)
}

seems more readable to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it. Does this look more reasonable? I'm trying to provision for more complicated keys (e.g. telemetry on/off options) and seems like a bunch of base cases is easier to maintain (similar to recommendation to use test case structs).

Signed-off-by: Kuat Yessenov <kuat@google.com>
@kyessenov kyessenov changed the title mixer: add protobuf caching mixerfilter: add protobuf caching Feb 1, 2019
@kyessenov
Copy link
Copy Markdown
Contributor Author

@rshriram caching per proxy would lead to a massive cache. It's far better to let the filter decide how to cache. In this case, we compute a cache key from a proxy, and then do a cache lookup.

Signed-off-by: Kuat Yessenov <kuat@google.com>

// fallback to regular call
if config == nil {
config = util.MessageToAny(buildRouteConfig(direction, istioConfig, push, disablePolicy, hostname))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mandarjog I am adding a fallback to pass the tests. Something in pilot does not always call OnPrecompute which causes the tests to fail.

@kyessenov
Copy link
Copy Markdown
Contributor Author

/test istio-unit-tests

1 similar comment
@kyessenov
Copy link
Copy Markdown
Contributor Author

/test istio-unit-tests

@mandarjog
Copy link
Copy Markdown
Contributor

@rshriram any reason for precompute not being called? The fallback if config==nil is problematic. It means that suddenly multiple go routines are accessing and updating the structure.

@kyessenov
Copy link
Copy Markdown
Contributor Author

/test istio-unit-tests

There is no concurrent write access issue, since the cache is not written to after precompute.
The cause for missing precompute is somewhere in the mocks, but it's hard to find it.

@kyessenov
Copy link
Copy Markdown
Contributor Author

Friendly ping @douglas-reid @mandarjog .

@rshriram rshriram added this to the 1.1 milestone Feb 11, 2019
@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Feb 17, 2019
@munrodg
Copy link
Copy Markdown

munrodg commented Feb 27, 2019

@kyessenov PR needs rebase

Signed-off-by: Kuat Yessenov <kuat@google.com>
@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kyessenov
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: costinm

If they are not already assigned, you can assign the PR to them by writing /assign @costinm in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@istio-testing istio-testing removed approved needs-rebase Indicates a PR needs to be rebased before being merged labels Feb 27, 2019
@kyessenov
Copy link
Copy Markdown
Contributor Author

kyessenov commented Feb 27, 2019

@mandarjog @douglas-reid Please take another look.

Recent changes about client retries do not affect this PR. Those changes affect client configs, while this change affects service configs.

@istio-testing
Copy link
Copy Markdown
Collaborator

@kyessenov: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
prow/e2e-simpleTests-cni.sh 40a1824 link /test e2e-simpleTests-cni
prow/istio-integ-k8s-tests.sh 40a1824 link /test istio-integ-k8s-tests
prow/istio-pilot-multicluster-e2e.sh 40a1824 link /test istio-pilot-multicluster-e2e
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@stale
Copy link
Copy Markdown

stale bot commented Mar 13, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 2 weeks. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale label Mar 13, 2019
@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Mar 17, 2019
@stale stale bot removed the stale label Mar 17, 2019
@stale
Copy link
Copy Markdown

stale bot commented Mar 27, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 2 weeks. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale label Mar 27, 2019
@stale
Copy link
Copy Markdown

stale bot commented Apr 27, 2019

This pull request has been automatically closed because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR needs to be rebased before being merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants