// Module included in the following assemblies:
//
// assembly-configuring.adoc

[id='con-address-plans-{context}']
= Address plans

Address plans specify the expected resource usage of a given address. The sum of the resource usage for all resource types determines the amount of infrastructure provisioned for an address space. A single router and broker pod has a maximum usage of one. If a new address requires additional resources and the resource consumption is within the address space plan limits, a new pod will be created automatically to handle the increased load.

Address plans are configured by the {ProductName} service operator and are selected when creating an address.

{ProductName} includes a default set of address plans that are sufficient for most use cases.

In the link:{BookUrlBase}{BaseProductVersion}{BookNameUrl}#con-address-space-plans-messaging[Address space plans] section, the address space plan references two address plans: `small-queue` and `small-anycast`. These address plans are stored as custom resources and are defined as follows:

[source,yaml,options="nowrap"]
----
apiVersion: admin.enmasse.io/v1beta2
kind: AddressPlan
metadata:
  name: small-queue
  labels:
    app: enmasse
spec:
  displayName: Small queue plan
  displayOrder: 0
  shortDescription: A plan for small queues
  longDescription: A plan for small queues that consume little resources
  addressType: queue <1>
  resources: <2>
    router: 0.2
    broker: 0.3
  partitions: 1 <3>
----
<1> The address type this plan applies to.
<2> The resources consumed by addresses using this plan. The `router` field is optional for address plans referenced by a `brokered` address space plan.
<3> The number of partitions that should be created for queues using this plan. Only available in the `standard` address space.

The other fields are used by the {ConsoleName} UI.

A single router can support five instances of addresses and broker can support three instances of addresses with this plan. If the number of addresses with this plan increases to four, another broker is created. If it increases further to six, another router is created as well.

In the `standard` address space, address plans for the `queue` address type may contain a field
`partitions`, which allows a queue to be sharded accross multiple brokers for HA and improved performance. Specifying an amount of `broker` resource above 1 will automatically cause a queue to be partitioned. 

NOTE: A sharded queue no longer guarantees message ordering.

Although the example address space plan in link:{BookUrlBase}{BaseProductVersion}{BookNameUrl}#con-address-space-plans-messaging[Address space plans] allows two routers and two brokers to be deployed, it only allows two pods to be deployed in total. This means that the address space is restricted to three addresses with the `small-queue` plan.

The `small-anycast` plan does not consume any broker resources, and can provision two routers at the expense of not being able to create any brokers:

[source,yaml,options="nowrap"]
----
apiVersion: admin.enmasse.io/v1beta2
kind: AddressPlan
metadata:
  name: small-anycast
  labels:
    app: enmasse
spec:
  addressType: anycast
  resources:
    router: 0.2
----

With this plan, up to 10 addresses can be created.
