Docker Swarm stack at Oracle Cloud OCI using ARM processors

Marcelo Ochoa
ITNEXT
Published in
5 min readJun 24, 2021

--

ARM Ampere Processor

Oracle Cloud Infrastructure (OCI) offers Ampere Altra processors and the industry’s first 80-core Arm server at only $0.01 per core hour, with flexible sizing from 1–80 OCPUs and 1–64 GB of memory per core. The OCI Ampere Altra A1 compute platform provides deterministic performance, linear scalability, and a secure architecture with the best price-performance in the market.

This article is continuation of a following series of related post:

But instead of describing how to deploy following step by step instructions this post is about using Infrastructure as Code using Terraform and Oracle Resource Manager, at the end of the post you have a four node Swarm Cluster at Oracle Always Free instance just in a few clicks.

Let’s start first introduction our test environment, see deployment diagram:

Deploy Diagram

We see above that there is shared storage, this shared storage is implemented using VM Block storage and replicated using GlusterFS, the storage is designed for block level IO such PostgreSQL or MySQL and there is new one shared storage for our Docker containers implemented using Object Storage designed for storing HTML pages, images, configuration files or Docker Registry blob objects.

Note: By adding a Docker plugin for Oracle Object Storage We can access from the Oracle Cloud Shell as a regular file system. Docker S3 volume plugin and GlusterFS volume plugin for Docker is available at GitHub/DockerHub for ARM (S3Fs/GlusterFS) and X86_64 (S3Fs/GlusterFs) platforms.

Deploy Files

Sample scripts and configuration files are available at my GitHub repo oci-swarm-cluster, arm brach, just clone and execute:

$ git clone https://github.com/marcelo-ochoa/oci-swarm-cluster -b arm
$ cd oci-swarm-cluster
$ zip -r ../oci-swarm-stack.zip .

And that’s all, oci-swarm-stack.zip is the file used to create a Swarm Stack.

Deploy Docker Swarm Stack

Following a four click guide using Oracle Cloud Console, Resource Manager->Stacks menu

Resource Manager Pane

Choose Create Stack, ZIP File configuration and Browse for your generated oci-swarm-stack.zip file

Create Stack — Stack Information

click Next and deselect auto generated public SSH keys, choose a public key from your machine, this public key will allow you to access the compute instances created for the cluster.

Create Stack — Configure Variables

Click next and review public key and stack information

Create Stack — Review

Click Create and your Terraform stack will be created, if RUN APPLY is selected the stack is automatically created, after a few minutes you will see an output like:

Resource Manager — Job Details

At the end of the log you will see something like:

Apply complete! Resources: 44 added, 0 changed, 0 destroyed.
Outputs:
autonomous_database_password = db_auto_generated_password
comments = The application URL will be unavailable for a few minutes after provisioning, while the application is configured
deploy_id = Xi8r
deployed_to_region = us-ashburn-1
dev = Made with ❤ by Marcelo Ochoa
generated_private_key_pem = No Keys Auto Generated
lb_public_url = http://150.136.128.59
oci_swarm_basic_source_code = https://github.com/marcelo-ochoa/oci-swarm-cluster

Some tweaks

The stack included as example on this deploy includes:

  • Docker v2 registry repo using OCI Object Storage
  • Portainer Visual Tool for administering Docker Swarm stack
  • LetsEncrypt SSL cert generation

Last point requires that you have a valid A DNS entry for each hostname declared into docker-compose.yml pointing to the Load Balancer public IP, for example using NoIP.com

NoIP Sample Output A resources

If you have public DNS entries like above edit your docker-compose.yml file and re-deploy the swarm stack, docker-compose.yml file will look like:

  • - traefik.http.routers.portainer.rule=(Host(`portainer-oci.hopto.org`) && PathPrefix(`/`))
  • - traefik.http.routers.registry.rule=(Host(`registry-oci.hopto.org`) && PathPrefix(`/v2/`))

These values will ensure that Traefik will generate valid SSL certificates from LetsEncrypt Acme Bot.

[root@oci-swarm-xi8r-0 ~]# vi docker-compose.yml
[root@oci-swarm-xi8r-0 ~]# source /root/swarm.env
[root@oci-swarm-xi8r-0 ~]# export $(cut -d= -f1 /root/swarm.env)[root@oci-swarm-xi8r-0 ~]# docker stack deploy -c docker-compose.yml swarm
Updating service swarm_traefik (id: h5yoa5iary7su5yg5snc4xl0i)
Updating service swarm_whoami (id: jxc83xcimu8292coaof7348wg)
Updating service swarm_registry (id: j7l3n7qdfwaduhrejpglg6bwj)
Updating service swarm_agent (id: v5iqree794b47zm6o8cxiineo)
Updating service swarm_portainer (id: 9r8g06wh3en9bzllr63510dcz)
Portainer UI

Performance

With new ARM processors and shapes We redo some performance test as in article Estimating Micro services max DB throughput here the result:

Two microservices with 8 concurrent connections (docker service scale sb_soecs=2):

soecs:
image: swingbench:2.6.0
command: /opt/swingbench/bin/charbench -cf /opt/Wallet_test1.zip -cs test1_tpurgent -c /opt/swingbench/configs/SOE_Client_Side.xml -u soe -p ${SOE_PWD} -uc 8 -a -v users,tpm,tps,cpu,disk -mt 20000 -mr
Author : Dominic Giles
Version : 2.6.0.1135
Results will be written to results.xml.
..... lots of output here ....
|Maximum Transactions/min | 13255|
|Average Transactions/sec | 206.27|
|Maximum Transactions/min | 14266|
|Average Transactions/sec | 227.28|
.....
Completed Run.

Four micro-services with 4 concurrent connections (docker service scale sb_soecs=4):

soecs:
image: swingbench:2.6.0
command: /opt/swingbench/bin/charbench -cf /opt/Wallet_test1.zip -cs test1_tpurgent -c /opt/swingbench/configs/SOE_Client_Side.xml -u soe -p ${SOE_PWD} -uc 4 -a -v users,tpm,tps,cpu,disk -mt 10000 -mr
Author : Dominic Giles
Version : 2.6.0.1135
Results will be written to results.xml.
..... lots of output here ....
|Maximum Transactions/min | 5655|
|Average Transactions/sec | 89.30|
|Maximum Transactions/min | 5692|
|Average Transactions/sec | 91.77|
|Maximum Transactions/min | 5649|
|Average Transactions/sec | 89.29|
|Maximum Transactions/min | 6514|
|Average Transactions/sec | 104.21|
.....
Completed Run.

In both scenarios two nodes/two micro-services or four nodes/four micro-services ARM processors will get twice as much throughput than AMD OCI Shapes for a lower price!!!

--

--