Giter Club home page Giter Club logo

old_mixerclient_repo's Introduction

Istio Mixerclient

The Istio Mixerclient is a C++ library to support the mixer API with following features:

  • Uses simple struct Attributes to pass attributes. The library will convert them to the request proto message by using the global dictionary and per message dictionary.

  • Supports combining multiple quota calls into one single Check call together with precondition check.

  • Supports cache for precondition check result. Attributes used to calculate cache key are specified by the Mixer. By default, check cache is enabled unless CheckOptions.num_entries is 0.

  • Supports quota cache and prefetch. Attributes used to calculate quota cache key are specified by the Mixer too. By default, quota cache is enabled unless QuotaOptions.num_entries is 0.

  • Supports batch for Reports. All report requests are batched up to ReportOptions.max_batch_entries, or up to ReportOptions.max_match_time_ms.

old_mixerclient_repo's People

Contributors

chowchow316 avatar istio-testing avatar jimmycyj avatar kyessenov avatar lizan avatar mandarjog avatar qiwzhang avatar rkpagadala avatar sebastienvas avatar yuval-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

old_mixerclient_repo's Issues

Support check cache keys from string map attributes

Now the check cache keys are a list of attribute names. e.g.

[
"request.path",
request.host"
]

A StringMap attribute such as "request.headers" has to use all its values.

It will be useful if we could choose some of keys out of a string map. such as ":method".

One idea is to use

"request.headers/:method" If there is a "/" in the cache key, the second portion is for the key within the map.

Make the set of request headers sent to Mixer configurable

We should make the set of request headers sent by the proxy to Mixer to be configurable such as to reduce the payload size of proxy RPCs to Mixer.

For now, the specific set will need to be configured by hand. But in the future, this can be handled automatically by observing what Mixer actually consumes and configuring the proxy accordingly.

destination.ip not sent as []byte

Expected to receive attribute destination.ip as a []byte. Instead, received string.

Example from attribute bag dump in latest Mixer:

destination.ip                : 10.56.2.185
source.ip                     : [10 150 0 5]

Note the key difference between the way in which source.ip and destination.ip are received.

Add trace spans for client

For the distributed tracing features of Istio, we want to have mixerclient spans in the generated trace data. This would help with a number of debug-ability related items:

  • better understanding caching
  • better understanding perf of client library
  • better understanding impact of network

cc: @rshriram

Provide statistics

for
number of Check calls,
number of cache hits
number of quota calls for each metric
number of quota cache hits for each metric
number of report calls
number of remote report calls

need more details for report_batch.cc:78] Mixer Report failed with: UNAVAILABLE

We see quite a lot of :

W0908 06:04:25.765] [libprotobuf ERROR external/mixerclient_git/src/report_batch.cc:78] Mixer Report failed with: UNAVAILABLE

eg https://k8s-gubernator.appspot.com/build/istio-prow/pull/istio_istio/699/e2e-suite-rbac-no_auth/360/

it would be great upon error to print which ip etc. we were connecting to and more details and granularity about the failure (did we fail to connect, did we timeout, did we not get a response, did we get a weird response, read error etc... (did we read anything, if so print that)

cc @mandarjog

Make the set of attributes sent to the Mixer to be configurable

Add configuration control over which attributes should be sent to Mixer for both Check and Report. This will optimize the RPC exchanges between proxy and Mixer.

Although this configuration will set initially set by hand, eventually we can generate this config state automatically based on what the Mixer is configured to use.

There should be different configuration state for Check and Report.

Introduce an attribute specialization framework

We want to express caching in the proxy in terms of attributes. If a specific set of attributes remains constant for a given time and given # of uses, we can use a cached result for Check.

The attributes we have today often do not play well with the above goal because they aren't specific enough, leading to potentially completely ineffective caching. More specifically, there are cases where several different attribute values should be treated similarly from a caching perspective and are not. Some examples of this:

  • The quintessential example of this is request.size, where the semantics we'd like is "all request.size values < XXX".

  • Another example is request.time where we'd like to say things like "all requests between 12:00AM and 6:00AM".

  • Finally, request.url contains method names which we want to operate on specifically, having different cached answers for different methods.

The solution to these problems involves introducing an attribute specialization model within the client such that it can produce derived attributes based on its existing set. These derived attributes would be sufficiently fine-grained to allow effective caching. This can be driven by relatively simple code and simple configuration within the client. For example:

  • request.size. Generate the request.size.scale attribute which is a string assigned via config based on the range of the size. For example, the config can specify small:0..20, medium:21..200, large:201

  • request.time. Generate a variety of attributes automatically such as request.time.hour, request.time.dayOfWeek, etc. Also, generate the config-driven request.time.scheduledEvent attribute with stuff like offtimes: 0:00-6:00,18:00-23:59

  • request.url is broken down per Swagger
    In other words, we have specialized attribute processing algebra for a variety of attributes which is intended to produce new finer-grained attributes against which policies are applied in Mixer. To improve caching, we will encourage Mixer config to be authored using these derived attributes when possible.

We need to look at the individual attributes we produce and figure out what kind of specialization makes sense for each, and what kind of config syntax we want to control this. Finally, we need to decide which of these derived attributes are the most useful in the short term in order to prioritize implementation work.

Elevate common request headers to attributes

We need to move common request headers to be first class attributes in order to improve cache efficiency. If the Mixer references any request headers during a Check call, the cache entry ends up being invalidated whenever any request header changes, which is the normal case. This effect completely neutralizes the existing cache.

Hook up platform logging

Now the library is using GOOGLE_LOG. It is better to use the callers (Envoy) to provide logging function.

httpFault/abort rules trigger does not send data to Prometheus

@esnible commented on Tue May 30 2017

To reproduce, start up bookinfo.

cat << EOF |
type: route-rule
name: ratings-fail-xpercent
spec:
  destination: ratings.default.svc.cluster.local
  precedence: 2
  httpFault:
    abort:
      percent: 95
      httpStatus: 500
EOF
istioctl replace

Drive some traffic. Then look at the output in Prometheus or ServiceGraph. The traffic is reduced by the %, but there are no response_code entries for the injected 500s.


@ZackButcher commented on Tue May 30 2017

This is likely a problem in either Envoy's Mixer filter or the mixerclient itself. Mixer just blindly pushes the data we're provided to the metric backend, these missing stats seem to indicate that Report calls aren't being made to the mixer by Envoy when it sees a 500.


@douglas-reid commented on Tue May 30 2017

@qiwzhang any ideas what might cause this related to the filter chain?

Support automatic dictionary fallback to recover gracefully from dictionary mismatches

We should have support in mixerclient to recognize that the Mixer is using an older dictionary. Whenever this happens, the mixerclient would switch to using the V1 dictionary from that point forward (until the process is restarted that is). So a single Mixer instance not having been upgraded to the latest dictionary will lead to using an older dictionary, which would reduce overall compression, but would avoid a dictionary-related outage.

Doing this effectively means we can upgrade the dictionary in the client and mixer independently, they don't need to be in sync.

remove uuid dependency

it looks that mixerclient added a dependency on libuuid from
e2fsprogs, which isn't part of base OS (i.e. Goobuntu doesn't have it
installed by default).

However, this dependency wasn't added via Bazel, so the build is
broken and not hermetic at all.

I wanted to make a PR adding libuuid, but it looks that it's licensed
under GPLv2, which means that we cannot statically link against it,
AFAIK.

I think it is from util-linux, yes it is still LGPL, so I think we should remove the dependency.

Envoy has its own uuid impl:
https://github.com/lyft/envoy/blob/master/source/common/runtime/runtime_impl.cc#L28

Use timer to flush out expired cache items

For all cached items, check and quota.

For quota, it is tricky, Some callback functions attached to on-progress requests may use the expired items. Have to be careful when removing them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.