Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magnum container operation comparision
- async output
- sync output
- utility
- docker events
conclusion: A sequence of container creation, start and delete in sequence, in synchronous mode, took (31 + 37 + 17) = 85 seconds
whereas the same sequence took (2 + 1 + 1) = 4 seconds in asynchronous mode, from the magnum client point of view.
From docker event point of view, the operations are issued within 31 seconds in async mode, compare to 64 seconds in sync mode.
[fedora@sw-kkwgu2za2ex-0-rc4tyjqtjwgf-swarm-node-ftz2u6bjlk74 ~]$ sudo docker events
2016-01-26T20:20:27.000000000Z docker.io/cirros:latest: pull
2016-01-26T20:20:35.000000000Z d6fb31ca48b1b266449e9d4e8e7e91c5ce9ea6d0c28daef03f1d41fc6d1c292c: (from docker.io/cirros:latest) create
2016-01-26T20:20:45.000000000Z d6fb31ca48b1b266449e9d4e8e7e91c5ce9ea6d0c28daef03f1d41fc6d1c292c: (from docker.io/cirros:latest) start
2016-01-26T20:20:52.000000000Z d6fb31ca48b1b266449e9d4e8e7e91c5ce9ea6d0c28daef03f1d41fc6d1c292c: (from docker.io/cirros:latest) die
2016-01-26T20:20:58.000000000Z d6fb31ca48b1b266449e9d4e8e7e91c5ce9ea6d0c28daef03f1d41fc6d1c292c: (from docker.io/cirros:latest) destroy
^C[fedora@sw-kkwgu2za2ex-0-rc4tyjqtjwgf-swarm-node-ftz2u6bjlk74 ~]$
[fedora@sw-kkwgu2za2ex-0-rc4tyjqtjwgf-swarm-node-ftz2u6bjlk74 ~]$ sudo docker events
2016-01-26T20:41:15.000000000Z docker.io/cirros:latest: pull
2016-01-26T20:41:23.000000000Z 0684798693f3b195a0ba84e18b981b62f20343c2b4ed85646208f2cf54d49e91: (from docker.io/cirros:latest) create
2016-01-26T20:41:51.000000000Z 0684798693f3b195a0ba84e18b981b62f20343c2b4ed85646208f2cf54d49e91: (from docker.io/cirros:latest) start
2016-01-26T20:42:01.000000000Z 0684798693f3b195a0ba84e18b981b62f20343c2b4ed85646208f2cf54d49e91: (from docker.io/cirros:latest) die
2016-01-26T20:42:19.000000000Z 0684798693f3b195a0ba84e18b981b62f20343c2b4ed85646208f2cf54d49e91: (from docker.io/cirros:latest) destroy
^C[fedora@sw-kkwgu2za2ex-0-rc4tyjqtjwgf-swarm-node-ftz2u6bjlk74 ~]$
[suro@oxy-dev ~]$ cat /etc/magnum/magnum.conf | grep async_enable
async_enable = True
[suro@oxy-dev ~]$ #restart_magnum_api_and_conductor
[suro@oxy-dev ~]$ cat /opt/stack/logs/m-api.log | grep async_enable | tail -1
2016-01-26 20:14:04.559 DEBUG magnum.cmd.api [-] async_enable = True from (pid=16036) log_opt_values /usr/lib/python2.7/site-packages/oslo_config/cfg.py:2380
[suro@oxy-dev ~]$ cat /opt/stack/logs/m-cond.log | grep async_enable | tail -1
2016-01-26 20:14:07.947 DEBUG oslo_service.service [-] async_enable = True from (pid=16058) log_opt_values /usr/lib/python2.7/site-packages/oslo_config/cfg.py:2380
[suro@oxy-dev ~]$ magnum_containers_async_op_suite 1
+ _count=1
+ create_magnum_containers 1
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-create --name test-container-condx1 --image docker.io/cirros:latest --bay swarmbay --command 'sudo ifconfig -a; ping -c 4 8.8.8.8'
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------+
| Property | Value
|
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------+
| status | Create-in-progress
|
| uuid | c46f6788-c71a-48a5-b868-dee96a651282
|
| links | ["{u'href': u'http://10.90.33.207:9511/v1/containers/c46f6788-c71a-48a5-b868-dee96a651282', u'rel': u'self'}", "{u'href': u'http://10.90.33.207:9511/containers/
c46f6788-c71a-48a5-b868-dee96a651282', u'rel': u'bookmark'}"] |
| created_at | 2016-01-26T20:20:19+00:00 |
| updated_at | 2016-01-26T20:20:19+00:00 |
| environment | {} |
| command | sudo ifconfig -a; ping -c 4 8.8.8.8 |
| bay_uuid | 74bab619-23e2-45cd-a63f-32422590e2a5 |
| memory | None |
| image | docker.io/cirros:latest |
| name | test-container-condx1 |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+ duration=2
+ printf 'The run took %d seconds\n' 2
The run took 2 seconds
+ op_magnum_containers start 1
+ verb=start
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-start test-container-condx1
+ duration=1
+ printf 'The run took %d seconds\n' 1
The run took 1 seconds
+ op_magnum_containers delete 1
+ verb=delete
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-delete test-container-condx1
+ duration=1
+ printf 'The run took %d seconds\n' 1
The run took 1 seconds
+ set +x
[suro@oxy-dev ~]$
[suro@oxy-dev ~]$ cat /etc/magnum/magnum.conf | grep async_enable
async_enable = False
[suro@oxy-dev ~]$ #restart_magnum_api_and_conductor
[suro@oxy-dev ~]$ cat /opt/stack/logs/m-api.log | grep async_enable | tail -1
2016-01-26 20:02:27.362 DEBUG magnum.cmd.api [-] async_enable = False from (pid=13996) log_opt_values /usr/lib/python2.7/site-packages/oslo_config/cfg.py:2380
[suro@oxy-dev ~]$ cat /opt/stack/logs/m-cond.log | grep async_enable | tail -1
2016-01-26 20:02:23.161 DEBUG oslo_service.service [-] async_enable = False from (pid=13966) log_opt_values /usr/lib/python2.7/site-packages/oslo_config/cfg.py:2380
[suro@oxy-dev ~]$ magnum_containers_async_op_suite 1
+ _count=1
+ create_magnum_containers 1
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-create --name test-container-condx1 --image docker.io/cirros:latest --bay swarmbay --command 'sudo ifconfig -a; ping -c 4 8.8.8.8'
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Property | Value |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| status | Stopped |
| uuid | 6b84ba3f-5518-4eec-b6d3-3cad4484b434 |
| links | ["{u'href': u'http://10.90.33.207:9511/v1/containers/6b84ba3f-5518-4eec-b6d3-3cad4484b434', u'rel': u'self'}", "{u'href': u'http://10.90.33.207:9511/containers/6b84ba3f-5518-4eec-b6d3-3cad4484b434', u'rel': u'bookmark'}"] |
| created_at | 2016-01-26T20:07:24+00:00 |
| updated_at | None |
| environment | None |
| command | sudo ifconfig -a; ping -c 4 8.8.8.8 |
| bay_uuid | 74bab619-23e2-45cd-a63f-32422590e2a5 |
| memory | None |
| image | docker.io/cirros:latest |
| name | test-container-condx1 |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+ duration=31
+ printf 'The run took %d seconds\n' 31
The run took 31 seconds
+ op_magnum_containers start 1
+ verb=start
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-start test-container-condx1
+ duration=37
+ printf 'The run took %d seconds\n' 37
The run took 37 seconds
+ op_magnum_containers delete 1
+ verb=delete
+ count=1
+ SECONDS=0
++ seq 1 1
+ for i in '`seq 1 $count`'
+ magnum container-delete test-container-condx1
+ duration=17
+ printf 'The run took %d seconds\n' 17
The run took 17 seconds
+ set +x
[suro@oxy-dev ~]$
#!/bin/bash
function create_magnum_containers ()
{
count=${1:-5}
SECONDS=0
for i in `seq 1 $count`;
do
magnum container-create --name test-container-condx$i \
--image docker.io/cirros:latest \
--bay swarmbay \
--command "sudo ifconfig -a; ping -c 4 8.8.8.8"
done
duration=$SECONDS
printf "The run took %d seconds\n" $duration
}
function op_magnum_containers ()
{
verb=${1:-show}
count=${2:-5}
SECONDS=0
for i in `seq 1 $count`;
do
magnum container-$verb test-container-condx$i
done
duration=$SECONDS
printf "The run took %d seconds\n" $duration
}
function magnum_containers_async_op_suite ()
{
set -x
_count=${1:-5}
create_magnum_containers $_count
op_magnum_containers start $_count
op_magnum_containers delete $_count
set +x
}
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment