Documentation ¶
Overview ¶
Package usl provides functionality to build Universal Scalability Law models from sets of observed measurements.
Index ¶
- Variables
- type Measurement
- type Model
- func (m *Model) CoherencyConstrained() bool
- func (m *Model) ConcurrencyAtLatency(r float64) float64
- func (m *Model) ConcurrencyAtThroughput(x float64) float64
- func (m *Model) ContentionConstrained() bool
- func (m *Model) LatencyAtConcurrency(n float64) float64
- func (m *Model) LatencyAtThroughput(x float64) float64
- func (m *Model) Limitless() bool
- func (m *Model) MaxConcurrency() float64
- func (m Model) MaxThroughput() float64
- func (m *Model) String() string
- func (m *Model) ThroughputAtConcurrency(n float64) float64
- func (m *Model) ThroughputAtLatency(r float64) float64
Constants ¶
This section is empty.
Variables ¶
var ErrInsufficientMeasurements = fmt.Errorf("usl: need at least %d measurements", minMeasurements)
ErrInsufficientMeasurements is returned when fewer than 6 measurements were provided.
Functions ¶
This section is empty.
Types ¶
type Measurement ¶
type Measurement struct { Concurrency float64 // The average number of concurrent events. Throughput float64 // The long-term average arrival rate of events, in events/sec. Latency float64 // The average duration of events in seconds. }
Measurement is a simultaneous measurement of at least two of the parameters of Little's Law: concurrency, throughput, and latency. The third parameter is inferred from the other two.
func ConcurrencyAndLatency ¶
func ConcurrencyAndLatency(n uint64, r time.Duration) Measurement
ConcurrencyAndLatency returns a measurement of a system's latency at a given level of concurrency. The throughput of the system is derived via Little's Law.
func ConcurrencyAndThroughput ¶
func ConcurrencyAndThroughput(n uint64, x float64) Measurement
ConcurrencyAndThroughput returns a measurement of a system's throughput at a given level of concurrency. The latency of the system is derived via Little's Law.
func ThroughputAndLatency ¶
func ThroughputAndLatency(x float64, r time.Duration) Measurement
ThroughputAndLatency returns a measurement of a system's latency at a given level of throughput. The concurrency of the system is derived via Little's Law.
func (*Measurement) String ¶
func (m *Measurement) String() string
type Model ¶
type Model struct { Sigma float64 // The model's coefficient of contention, σ. Kappa float64 // The model's coefficient of crosstalk/coherency, κ. Lambda float64 // The model's coefficient of performance, λ. }
Model is a Universal Scalability Law model.
func Build ¶
func Build(measurements []Measurement) (m *Model, err error)
Build returns a model whose parameters are generated from the given measurements.
Finds a set of coefficients for the equation y = λx/(1+σ(x-1)+κx(x-1)) which best fit the observed values using unconstrained least-squares regression. The resulting values for λ, κ, and σ are the parameters of the returned model.
func (*Model) CoherencyConstrained ¶
CoherencyConstrained returns true if the system is constrained by coherency costs.
func (*Model) ConcurrencyAtLatency ¶
ConcurrencyAtLatency returns the expected number of concurrent events at a particular mean latency, N(R).
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 10".
func (*Model) ConcurrencyAtThroughput ¶
ConcurrencyAtThroughput returns the expected number of concurrent events at a particular throughput, N(X).
func (*Model) ContentionConstrained ¶
ContentionConstrained returns true if the system is constrained by contention.
func (*Model) LatencyAtConcurrency ¶
LatencyAtConcurrency returns the expected mean latency given a number of concurrent events, R(N).
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 6".
func (*Model) LatencyAtThroughput ¶
LatencyAtThroughput returns the expected mean latency given a throughput, R(X).
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 8".
func (*Model) MaxConcurrency ¶
MaxConcurrency returns the maximum expected number of concurrent events the system can handle, Nmax.
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 4".
func (Model) MaxThroughput ¶
MaxThroughput returns the maximum expected throughput the system can handle, Xmax.
func (*Model) ThroughputAtConcurrency ¶
ThroughputAtConcurrency returns the expected throughput given a number of concurrent events, X(N).
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 3".
func (*Model) ThroughputAtLatency ¶
ThroughputAtLatency returns the expected throughput given a mean latency, X(R).
See "Practical Scalability Analysis with the Universal Scalability Law, Equation 9".