Capacity planning and scaling

Capacity planning and scaling

Cloud-based applications typically request more discrete hardware (horizontal scaling) as opposed to traditional applications, which require larger hardware to scale (vertical scaling).

OpenStack is designed to be horizontally scalable. Rather than switching to larger servers, you procure more servers and simply install identically configured services. Ideally, you scale out and load balance among groups of functionally identical services (for example, compute nodes or nova-api nodes), that communicate on a message bus.

Determining cloud scalability

Determining the scalability of your cloud and how to improve it requires balancing many variables. No one solution meets everyone’s scalability goals. However, it is helpful to track a number of metrics. You can define virtual hardware templates called 「flavors」 in OpenStack, which will impact your cloud scaling decisions. These templates define sizes for memory in RAM, root disk size, amount of ephemeral data disk space available, and the number of CPU cores.

デフォルトの OpenStack フレーバーは 表: OpenStack デフォルトのフレーバー に表示されています。

表: OpenStack デフォルトのフレーバー
名前 仮想コア数 メモリ ディスク エフェメラル
m1.tiny 1 512 MB 1 GB 0 GB
m1.small 1 2 GB 10 GB 20 GB
m1.medium 2 4 GB 10 GB 40 GB
m1.large 4 8 GB 10 GB 80 GB
m1.xlarge 8 16 GB 10 GB 160 GB

The starting point is the core count of your cloud. By applying some ratios, you can gather information about:

  • 実行する必要のある仮想マシン数: ((オーバーコミット比率 × コア数) / インスタンスあたりのコア数)
  • 必要とされるストレージ容量: (フレーバーのディスクサイズ × インスタンス数)

これらの比率を使用して、クラウドのサポートに必要なインフラストラクチャーがどの程度必要か判断することができます。

ここでは、期待される仮想マシン数や必要なストレージ数などの拡張性の情報を収集するために、これらの比率を使用した例を紹介しています。以下の数では、 (200 / 2) × 16 = 1600 仮想マシンのインスタンスをサポートし、 /var/lib/nova/instances のストレージ 80 TB が必要となります。

  • 物理コア 200 個
  • ほとんどのインスタンスのサイズは m1.medium (仮想コア数2、ストレージ50GB) とします。
  • Default CPU overcommit ratio (cpu_allocation_ratio in the nova.conf file) of 16:1.

注釈

オーバーコミット比率に関係なく、フレーバーの要求するリソースよりも(オーバーコミットの前に)リソースが少ない物理ノードにはインスタンスは配置されません。

しかし、APIサービスやデータベースサーバー、MQサーバーがおそらく遭遇する負荷を見積もるためには、コア数以外の検討も行う必要があります。クラウドの利用パターンも考慮しなければなりません。

特定の例としては、マネージド Web ホスティングプラットフォームをサポートするクラウドと、コードコミットごとに仮想マシンを1つ作成するような開発プロジェクトの統合テストを実行するクラウドを比較してみましょう。前者では、VMを作成する負荷の大きい処理は数か月に 一度しか発生しないのに対して、後者ではクラウドコントローラに常に負荷の大きい処理が発生します。一般論として、VMの平均寿命が長いということは、クラウドコントローラの負荷が軽いことを意味するため、平均的なVMの寿命を検討する必要があります。

Aside from the creation and termination of VMs, you must consider the impact of users accessing the service particularly on nova-api and its associated database. Listing instances garners a great deal of information and, given the frequency with which users run this operation, a cloud with a large number of users can increase the load significantly. This can occur even without their knowledge. For example, leaving the OpenStack dashboard instances tab open in the browser refreshes the list of VMs every 30 seconds.

これらの要素を検討した後、クラウドコントローラにどのくらいのコア数が必要なのか決定することができます。上記で説明した留意事項の下、典型的には、ラック 1 本分のコンピュートノードに対して8 コア、メモリ 8GB のサーバで充分です。

You must also consider key hardware specifications for the performance of user VMs, as well as budget and performance needs, including storage performance (spindles/core), memory availability (RAM/core), network bandwidth hardware specifications and (Gbps/core), and overall CPU performance (CPU/core).

ちなみに

For a discussion of metric tracking, including how to extract metrics from your cloud, see the OpenStack Operations Guide.

Adding cloud controller nodes

You can facilitate the horizontal expansion of your cloud by adding nodes. Adding compute nodes is straightforward since they are easily picked up by the existing installation. However, you must consider some important points when you design your cluster to be highly available.

A cloud controller node runs several different services. You can install services that communicate only using the message queue internally— nova-scheduler and nova-console on a new server for expansion. However, other integral parts require more care.

You should load balance user-facing services such as dashboard, nova-api, or the Object Storage proxy. Use any standard HTTP load-balancing method (DNS round robin, hardware load balancer, or software such as Pound or HAProxy). One caveat with dashboard is the VNC proxy, which uses the WebSocket protocol— something that an L7 load balancer might struggle with. See also Horizon session storage.

You can configure some services, such as nova-api and glance-api, to use multiple processes by changing a flag in their configuration file allowing them to share work between multiple cores on the one machine.

ちなみに

Several options are available for MySQL load balancing, and the supported AMQP brokers have built-in clustering support. Information on how to configure these and many of the other services can be found in the Operations Guide.

Segregating your cloud

Segregating your cloud is needed when users require different regions for legal considerations for data storage, redundancy across earthquake fault lines, or for low-latency API calls. It can be segregated by cells, regions, availability zones, or host aggregates.

メソッド毎に異なる機能を提供しますが、このメソッドは 2 つのグループに分類すると良いでしょう。

  • セルおよびリージョン。クラウド全体を分離し、個別にコンピュートデプロイメントを稼働します。
  • アベイラビリティゾーン およびホストアグリゲート。コンピュートのデプロイメントの分割のみを行います。

表: OpenStack 分離の手法 では、OpenStack Compute が現在提供している各分割メソッドの比較ビューを提供しています。

表: OpenStack 分離の手法
  セル リージョン アベイラビリティゾーン ホスト・アグリゲート
Use コンピュート資源に対する単一の API エンドポイント 、もしくは2段階スケジューリングが必要な場合 リージョンごとに別々のAPIエンドポイントが必要で、リージョン間で協調する必要がない場合 物理的な隔離や冗長性のために、Nova デプロイメントの中で論理的な分離が必要な場合 共通の機能を持ったホストのグループに対してスケジューリングしたい場合
複数サイトで構成されるクラウドで、仮想マシンを「任意のサイト」または特定のサイトにスケジューリングしたい場合 複数サイトで構成されるクラウドで、仮想マシンを特定のサイトに対してスケジューリングでき、かつ共有インフラを利用したい場合 分離された電源供給ラインを持つ設備で構成される、単一サイトのクラウド。 トラステッドコンピューティング機能に対応したホスト群に対してスケジューリングしたい場合
オーバーヘッド 試験的とみなされます。新しいサービス nova-cells。各セルには nova-api 以外の全 nova 設定が含まれています。 各リージョンは完全な nova インストール環境を持ちます。 nova.conf の設定を変更 nova.conf の設定を変更
共有サービス Keystone, nova-api Keystone Keystone、すべての Nova サービス Keystone、すべての Nova サービス

Cells and regions

OpenStack Compute のセルによって、より複雑な技術を持ち込むことなしに、また既存のNovaシステムに悪影響を与えることなしに、クラウドを分散された環境で運用することができます。1つのクラウドの中のホストは、 セル と呼ばれるグループに分割されます。セルは、木構造に構成されてます。最上位のセル (「API セル」) は nova-api サービスを実行するホストを持ちますが、 nova-compute サービスを実行するホストは持ちません。それぞれの子セルは、 nova-api サービス以外の、普通のNovaシステムに見られる他のすべての典型的な nova-* サービスを実行します。それぞれのセルは自分のメッセージキューとデータベースサービスを持ち、またAPIセルと子セルの間の通信を制御する nova-cells サービスを実行します。

これによって、複数のクラウドシステムに対するアクセスを、1つのAPIサーバで制御することができます。通常の nova-scheduler によるホストの選択に加えて、第二段階のスケジューリング(セルの選択)を導入することにより、仮想マシンを実行する場所の制御の柔軟性が大きく向上します。

単独の API エンドポイントを持つ場合と異なり、リージョンは、クラウドごとに別々のAPIエンドポイントを持ち、より細かい分離を実現できます。複数の拠点にまたがってインスタンスを実行するユーザーは、明示的にリージョンを指定しなければなりません。しかし、新規サービスを実行するなど、複雑化しなくて済みます。

OpenStack dashboard (horizon) は、複数のリージョンを使用するよう設定できます。これは AVAILABLE_REGIONS パラメーターにより設定できます。

Availability zones and host aggregates

You can use availability zones, host aggregates, or both to partition a nova deployment. Both methods are configured and implemented in a similar way.

アベイラビリティゾーン

アベイラビリティーゾーンにより、OpenStack Compute ホストを論理グループにまとめて、(独立した電源系統やネットワーク装置を使うことなどで)他のアベイラビリティーゾーンとの物理的な分離や冗長性を実現できます。

指定したコンピュートホストがローカルでサーバー毎に所属するアベイラビリティゾーンを定義します。アベイラビリティゾーンは一般的に、共通の属性を持つサーバーを識別するために使用されます。例えば、データセンターのラックの一部が別の電源を仕様している場合、このラックのサーバーを独自のアベイラビリティゾーンに入れることができます。アベイラビリティゾーンは、異なるハードウェアクラスを分割することもできます。

リソースのプロビジョニングの際には、インスタンスを作成するアベイラビリティゾーンを指定することができます。これによって、クラウドの利用者は、アプリケーションのリソースが異なるマシンに分散して配置され、ハードウェア故障が発生した場合でも高可用性を達成することができます。

ホストアグリゲートゾーン

これにより、OpenStack コンピュートデプロイメントを負荷分散やインスタンスディストリビューション用の論理グループに分割することができます。ホストアグリゲートを使用して、アベイラビリティゾーンをさらに分割することができます。例えば、ホストアグリゲートを使用してアベイラビリティゾーンをストレージやネットワークなどの共通のリソースを共有するか、信頼済みのコンピューティングハードウェアなどの特別なプロパティを持つホストグループに分割することができます。

ホストアグリゲートの一般的な用途は nova-scheduler で使用する情報を提供することです。例えば、ホストアグリゲートを使って、特定のフレーバーやイメージを共有するホストの集合を作成することができます。

この一般的なケースは、アグリゲートメタデータで key-value ペアを設定して、フレーバーの extra_specs メタデータで key-value ペアを一致させます。フィルタースケジューラーの AggregateInstanceExtraSpecsFilter は、強制的にインスタンスが、同じ値に同じキーが定義されているアグリゲートのホストに対してのみスケジューリングするようにします。

この一般的なコンセプトを高度なレベルで使用すると、集中度の高いコンピュートロードや負荷の低い開発やテストシステムが使用量の多いシステムのリソースが不足したり、使用量の低いシステムでリソースを無駄にしたりしないで、同じクラウドを共有できるように、異なるフレーバーの種別が、異なる CPU および RAM 割当の比率で実行できるようになります。 これは、ホストアグリゲートに metadata を設定して、フレーバー種別の extra_specs と一致させると機能します。

The first step is setting the aggregate metadata keys cpu_allocation_ratio and ram_allocation_ratio to a floating-point value. The filter schedulers AggregateCoreFilter and AggregateRamFilter will use those values rather than the global defaults in nova.conf when scheduling to hosts in the aggregate. Be cautious when using this feature, since each host can be in multiple aggregates, but should have only one allocation ratio for each resources. It is up to you to avoid putting a host in multiple aggregates that define different values for the same resource.

これは前半部分です。特定の比率を保証するフレーバー種別を取得するには、フレーバー種別の extra_specs をアグリゲートでマッチする key-value ペアに設定する必要があります。たとえば、extra_specs cpu_allocation_ratio を 1.0 に定義すると、その種別のインスタンスは、メタデータキー cpu_allocation_ratio1.0 と定義されているアグリゲートのみで実行されます。実際は、 cpu_allocation_ratio または core_allocation_ratio で直接マッチさせるのではなく、マッチするアグリゲートメタデータに追加の key-value ペアを定義すると良いでしょう。これにより抽象化が改善されます。たとえば、overcommit キーを定義して、高、中、低の値を設定することで、関連するフレーバー種別をすべて変更する必要なしに、アグリゲートの割合比を調節することができます。

注釈

以前のバージョンでは、全サービスにアベイラビリティゾーンがありました。現在は、nova-compute サービスには独自のアベイラビリティゾーンがあります。nova-schedulernova-networknova-conductor などのサービスは、常にすべてのアベイラビリティゾーンに対応します。

以下の操作のいずれかを実行する場合、サービスは独自の内部アベイラビリティゾーン(CONF.internal_service_availability_zone) に表示されます。

  • openstack host list (os-hosts)
  • euca-describe-availability-zones verbose
  • openstack compute service list

内部のアベイラビリティゾーンは、euca-describe-availability_zones (nonverbose) に隠し設定されています。

CONF.node_availability_zone は、CONF.default_availability_zone に名前が変更され、nova-api および nova-scheduler サービスのみで使用されます。

CONF.node_availability_zone は今も機能しますが、非推奨扱いです。

スケーラブルハードウェア

While several resources already exist to help with deploying and installing OpenStack, it’s very important to make sure that you have your deployment planned out ahead of time. This guide presumes that you have set aside a rack for the OpenStack cloud but also offers suggestions for when and what to scale.

ハードウェア調達

“The Cloud” has been described as a volatile environment where servers can be created and terminated at will. While this may be true, it does not mean that your servers must be volatile. Ensuring that your cloud’s hardware is stable and configured correctly means that your cloud environment remains up and running.

OpenStack can be deployed on any hardware supported by an OpenStack compatible Linux distribution.

ハードウェアに整合性を持たせる必要はありませんが、インスタンスのマイグレーションをサポートできるように、最低限、CPU の種類は同じにする必要があります。

The typical hardware recommended for use with OpenStack is the standard value-for-money offerings that most hardware vendors stock. It should be straightforward to divide your procurement into building blocks such as 「compute,」 「object storage,」 and 「cloud controller,」 and request as many of these as you need. Alternatively, any existing servers you have that meet performance requirements and virtualization technology are likely to support OpenStack.

キャパシティプランニング

OpenStack is designed to increase in size in a straightforward manner. Taking into account the considerations previous mentioned, particularly on the sizing of the cloud controller, it should be possible to procure additional compute or object storage nodes as needed. New nodes do not need to be the same specification or vendor as existing nodes.

For compute nodes, nova-scheduler will manage differences in sizing with core count and RAM. However, you should consider that the user experience changes with differing CPU speeds. When adding object storage nodes, a weight should be specified that reflects the capability of the node.

Monitoring the resource usage and user growth will enable you to know when to procure. The Logging and Monitoring chapte in the Operations Guide details some useful metrics.

エージング試験

サーバーハードウェアの故障確率は、そのライフタイムの最初と最後に高くなります。結論として、初期故障を誘発する適切なエージングテストを行うことによって、運用中の故障に対応するための多くの労力を避けることができます。一般的な原則は、限界まで負荷をかけることです。エージング試験の例としては、数日間にわたってCPUやディスクベンチマークを走行させることが含まれます。

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.