\Drupal\strata\Estimate FreeTierModel

Whether a projection fits inside what a provider gives away, and how big a site could.

The question an operator actually asks first is not what it costs but whether it costs anything, and on R2 the answer is usually no. The free allowance is three separate limits and only one of them binds: storage. Write requests never come close at any interval of five seconds or slower, because the request count depends on the flush interval rather than on the size of the site, and reads are only generated by verification and restore.

So the headline is a storage headline, and the capacity figure is found by searching rather than by a formula. Stored bytes are a monotone function of user count with several components that do not scale together - churn scales with active users, the tree scales with subjects, code does not scale at all - so a bisection over the projection is both simpler and more honest than inverting a model that has no inverse.

Summary

Methods
Properties
Constants
__construct
fits
usage
headroom
bindingAxis
capacity
summary
jsonSerialize
No public properties found
STORAGE
WRITES
READS
SEARCH_STEPS
SEARCH_CEILING
No protected methods found
No protected properties found
No protected constants found
No private methods found
prices
projection
No private constants found

Constant

STORAGE

STORAGE = 'storage'

Which limit a projection is closest to using up.

WRITES

WRITES = 'writes'

The write-request allowance.

READS

READS = 'reads'

The read-request allowance.

SEARCH_STEPS

SEARCH_STEPS = 24

Most bisection steps a capacity search takes.

A bound rather than a tolerance: the search halves an interval, so twenty-four steps resolve a hundred million users to single figures.

SEARCH_CEILING

SEARCH_CEILING = 100000000

Users the capacity search will not look past.

Properties

$prices

$prices : \Drupal\strata\Estimate\PriceTable

Type

PriceTable

$projection

$projection : \Drupal\strata\Estimate\Projection

Type

Projection

Methods

__construct()

__construct(\Drupal\strata\Estimate\PriceTable  $prices, \Drupal\strata\Estimate\Projection  $projection) : mixed

Constructs a verdict.

Parameters

\Drupal\strata\Estimate\PriceTable $prices

The provider being measured against.

\Drupal\strata\Estimate\Projection $projection

What was projected.

Returns

mixed —

fits()

fits() : bool

Whether the projection costs nothing.

Returns

bool —

TRUE when every axis is inside its allowance.

usage()

usage(string  $axis) : float

What share of one allowance the projection uses.

Parameters

string $axis

One of the axis constants.

Returns

float —

A fraction, which is above one when the allowance is exceeded and zero when the provider has no allowance on that axis.

headroom()

headroom(string  $axis) : int

How much of one allowance is left.

Parameters

string $axis

One of the axis constants.

Returns

int —

Bytes or requests, never below zero.

bindingAxis()

bindingAxis() : string

Which allowance is closest to being used up.

Returns

string —

An axis constant, or an empty string when the provider has no free tier.

capacity()

capacity(\Drupal\strata\Estimate\Estimator  $estimator, \Drupal\strata\Estimate\Measurement  $shape, \Drupal\strata\Estimate\PriceTable  $prices) : int

The largest user count that still fits in the free tier.

Everything else about the shape is held still and the user count is varied, because that is the dial an operator recognises. Nodes and rows are scaled with it in the same proportion the measurement already has, so a site with ten nodes per user keeps ten nodes per user.

Parameters

\Drupal\strata\Estimate\Estimator $estimator

The estimator to project with.

\Drupal\strata\Estimate\Measurement $shape

The shape to vary. Its user count is the starting point and is ignored otherwise.

\Drupal\strata\Estimate\PriceTable $prices

The provider.

Returns

int —

Users, or zero when even one user does not fit.

summary()

summary() : string

One line describing the verdict.

Returns

string —

The summary.

jsonSerialize()

jsonSerialize() : array<string,mixed>

{@inheritdoc}

Returns

array

The verdict as data.