activator

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

README

About the Activator

The name activator is actually a misnomer, since after Knative 0.2, the activator no longer activates inactive Revisions.

The only responsibilities of the activator are:

  • Receiving & buffering requests for inactive Revisions.
  • Reporting metrics to the autoscaler.
  • Retrying requests to a Revision after the autoscaler scales such Revision based on the reported metrics.

Documentation

Index

Constants

View Source
const (
	// Name is the name of the component.
	Name = "activator"
	// K8sServiceName is the name of the activator Kubernetes service.
	K8sServiceName = "activator-service"
	// RevisionHeaderName is the header key for revision name.
	RevisionHeaderName = "Knative-Serving-Revision"
	// RevisionHeaderNamespace is the header key for revision's namespace.
	RevisionHeaderNamespace = "Knative-Serving-Namespace"
)

Variables

View Source
var ErrActivatorOverload = errors.New("activator overload")

ErrActivatorOverload indicates that throttler has no free slots to buffer the request.

Functions

This section is empty.

Types

type Reporter added in v0.2.0

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter holds cached metric objects to report autoscaler metrics

func NewStatsReporter added in v0.2.0

func NewStatsReporter() (*Reporter, error)

NewStatsReporter creates a reporter that collects and reports activator metrics

func (*Reporter) ReportRequestConcurrency added in v0.8.0

func (r *Reporter) ReportRequestConcurrency(ns, service, config, rev string, v int64) error

ReportRequestConcurrency captures request concurrency metric with value v.

func (*Reporter) ReportRequestCount added in v0.3.0

func (r *Reporter) ReportRequestCount(ns, service, config, rev string, responseCode, numTries int, v int64) error

ReportRequestCount captures request count metric with value v.

func (*Reporter) ReportResponseTime added in v0.2.0

func (r *Reporter) ReportResponseTime(ns, service, config, rev string, responseCode int, d time.Duration) error

ReportResponseTime captures response time requests

type RevisionID added in v0.4.0

type RevisionID struct {
	Namespace string
	Name      string
}

RevisionID is the combination of namespace and revision name TODO(greghaynes) once we remove old throttler code for revision_backends we can delete this type (in leu of k8s NamespacedName)

func (RevisionID) String added in v0.5.0

func (rev RevisionID) String() string

String returns the namespaced name of the RevisionID.

type StatsReporter added in v0.2.0

type StatsReporter interface {
	ReportRequestConcurrency(ns, service, config, rev string, v int64) error
	ReportRequestCount(ns, service, config, rev string, responseCode, numTries int, v int64) error
	ReportResponseTime(ns, service, config, rev string, responseCode int, d time.Duration) error
}

StatsReporter defines the interface for sending activator metrics

type Throttler added in v0.4.0

type Throttler struct {
	// contains filtered or unexported fields
}

Throttler keeps the mapping of Revisions to Breakers and allows updating max concurrency dynamically of respective Breakers. Max concurrency is essentially the number of semaphore tokens the Breaker has in rotation. The manipulation of the parameter is done via `UpdateCapacity()` method. It enables the use case to start with max concurrency set to 0 (no requests are sent because no endpoints are available) and gradually increase its value depending on the external condition (e.g. new endpoints become available)

func NewThrottler added in v0.4.0

func NewThrottler(
	params queue.BreakerParams,
	endpointsInformer corev1informers.EndpointsInformer,
	sksLister netlisters.ServerlessServiceLister,
	revisionLister servinglisters.RevisionLister,
	logger *zap.SugaredLogger) *Throttler

NewThrottler creates a new Throttler.

func (*Throttler) MarkProbe added in v0.8.0

func (t *Throttler) MarkProbe(revID RevisionID)

MarkProbe marks revision as successfully probed.

func (*Throttler) Remove added in v0.4.0

func (t *Throttler) Remove(rev RevisionID)

Remove deletes the breaker from the bookkeeping.

func (*Throttler) ShouldProbe added in v0.8.0

func (t *Throttler) ShouldProbe(revID RevisionID) bool

ShouldProbe returns true if we should probe.

func (*Throttler) Try added in v0.4.0

func (t *Throttler) Try(ctx context.Context, rev RevisionID, function func()) error

Try potentially registers a new breaker in our bookkeeping and executes the `function` on the Breaker. It returns an error if either breaker doesn't have enough capacity, or breaker's registration didn't succeed, e.g. getting endpoints or update capacity failed.

func (*Throttler) UpdateCapacity added in v0.4.0

func (t *Throttler) UpdateCapacity(rev RevisionID, size int) error

UpdateCapacity updates the max concurrency of the Breaker corresponding to a revision.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL