在進行這個實作之前,原本以為GCE啟動1000個核心的等待時間令人感到非常沮喪,結果
大約只花100秒就能啟動1000個核心!
125個8核心服務器啟動時間為1分41秒
以下是實際操作的結果
date; time gcloud compute --project "cloud-ace-demo" instances create a`seq -s" a" 1 125` --zone "asia-east1-b" --machine-type "n1-highcpu-8" --network "default" --maintenance-policy "MIGRATE" --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write" --image "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20190326" --boot-disk-size "10" --boot-disk-type "pd-standard";date
[ayatoshi@asyura ~]$ date
Tue Apr 9 03:25:49 UTC 2019
[ayatoshi@asyura ~]$ date; time gcloud compute --project "cloud-ace-demo" instances create a`seq -s" a" 1 125` --zone "asia-east1-b" --machine-type "n1-highcpu-8" --network "default" --maintenance-policy "MIGRATE" --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write" --image "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20190326" --boot-disk-size "10" --boot-disk-type "pd-standard";date
Tue Apr 9 03:26:02 UTC 2019
WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks/persistent-disks#pdperformance.
Created [https://www.googleapis.com/compute/v1/projects/cloud-ace-demo/zones/asia-east1-b/instances/a105].
Created [https://www.googleapis.com/compute/v1/projects/cloud-ace-demo/zones/asia-east1-b/instances/a1].
・・・・省略
Created [https://www.googleapis.com/compute/v1/projects/cloud-ace-demo/zones/asia-east1-b/instances/a111].
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
a105 asia-east1-b n1-highcpu-8 10.240.0.9 104.199.142.32 RUNNING
a1 asia-east1-b n1-highcpu-8 10.240.0.6 130.211.253.212 RUNNING
a4 asia-east1-b n1-highcpu-8 10.240.0.2 104.155.213.0 RUNNING
・・・・・省略
a111 asia-east1-b n1-highcpu-8 10.240.0.123 104.155.223.161 RUNNING
real 1m41.179s
user 0m4.654s
sys 0m0.103s
Tue Apr 9 03:27:44 UTC 2019
有了如此快速的啟動速度,對於非預期增加的大量計算需求也能夠輕鬆應對
順帶一提的是,刪除這些大約只需要2分30秒就能完成