bradenwright / kitchen-lxd_cli

Test Kitchen driver for LXD
Other
10 stars 4 forks source link

kitchen speed #14

Open juju4 opened 8 years ago

juju4 commented 8 years ago

Just a remark, inside travis,

any idea what can be tuned?

As sidenote, lxd on travis is heavily network bound as we download images...

bradenwright commented 8 years ago

So I'll try to speak more to this/look into it, but figured I'd reply right away with what I know.

1) Waiting for SSH to become ready seems to be a bottleneck, if I/someone were to write an transport in lxd (vs using ssh) then it would speed up. enable_wait_for_ssh_login: false is default I believe, if its false then it speeds up ssh, but not relying on ssh would be nice.

2) When you say network bound, I did build in/have used polipo to setup a proxy, that way you only have to wait first time it downloads (not sure if docker is doing any caching)

3) Serverspec gem(s) install(s) are slow, I believe there was a bug which may or may not have been fixed were it installed everytime. https://github.com/bradenwright/kitchen-lxd_cli#verifier_path talks detail, you can try that. Or inspec works a lot faster and I've been using that, to get inspec to work I set

transport:
  name: sftp
  ssh_key: ~/.ssh/id_rsa

verifier:
  name: inspec

I'll look into it further/discuss with you more I just wanted to throw out a few things right away.

bradenwright commented 8 years ago

^^^ FYI I will look these further... especially (3) I know that rewrite your tests is not ideal.

bradenwright commented 8 years ago

FYI for (1) you maybe able to set docker to use the sftp transport, that may give you info on how much the speed is bound by the transport. But when you have a min let me know what you mean by you think its network bound downloading images.

Also do you know if lxd images are bigger than docker images? Is that part of the issue/factor.

juju4 commented 7 years ago

On 1, there is an easy alternative https://github.com/juju4/ansible-lxc-ssh it's a fork with support of lxd/lxc2 (basic s/lxc-attach --name/lxc exec/) so you have a transport config_option after it needs to be adapted for kitchen

On 2, yes locally, it's manageable with proxy but for test run inside travis, nothing I can do except asking them to add mirror

For 3, I'm also using inspec but for different usage, more security audit than infra testing. I also played with ansiblespec which maps ansible inventory and roles from playbook file. Not reviewed speed for now.

In both cases, the thing which annoys me is all packages kitchen download/install itself, part not used when using ansible.

Current lxc images I have

$ lxc image list
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
|         ALIAS         | FINGERPRINT  | PUBLIC |                  DESCRIPTION                  |  ARCH  |   SIZE   |          UPLOAD DATE          |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| alpine-3.4            | aa414120f1bc | no     |                                               | x86_64 | 21.71MB  | Aug 25, 2016 at 1:47am (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| alpine-3.4-nossh      | 5fae56e123cb | no     | Alpine 3.4 (amd64) (20160824_17:50)           | x86_64 | 2.63MB   | Aug 25, 2016 at 12:56am (UTC) |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| centos-6              | a59ca6b2c890 | no     |                                               | x86_64 | 129.94MB | Aug 25, 2016 at 12:08am (UTC) |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| centos-6-nossh        | 18c20e19cd84 | no     | Centos 6 (amd64) (20160814_02:16)             | x86_64 | 65.78MB  | Aug 14, 2016 at 3:10pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| centos-7              | a01e15be277c | no     |                                               | x86_64 | 151.96MB | Aug 14, 2016 at 3:15pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| centos-7-nossh        | 6ea75c01ccac | no     | Centos 7 (amd64) (20160814_02:16)             | x86_64 | 62.90MB  | Aug 14, 2016 at 3:10pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| ubuntu-12.04          | 38a72ae0da86 | no     | ubuntu 12.04 LTS amd64 (release) (20160808)   | x86_64 | 155.44MB | Aug 14, 2016 at 3:10pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| ubuntu-14.04          | 8f5108a99312 | no     | ubuntu 14.04 LTS amd64 (release) (20160809.1) | x86_64 | 119.36MB | Aug 14, 2016 at 3:06pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| ubuntu-16.04          | 6b01a4085ba9 | no     |                                               | x86_64 | 229.20MB | Aug 14, 2016 at 3:13pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+
| ubuntu-16.04-nopython | 199e9a37b6aa | no     | ubuntu 16.04 LTS amd64 (release) (20160721)   | x86_64 | 316.22MB | Aug 14, 2016 at 3:05pm (UTC)  |
+-----------------------+--------------+--------+-----------------------------------------------+--------+----------+-------------------------------+

As for docker size, I would expect to be in the same order. But it is more variable it seems my docker images goes from 5MB (Alpine linux) to 1GB or so. some analysis: http://developers.redhat.com/blog/2016/03/09/more-about-docker-images-size/ Surprisingly, did not find reference to a docker image mirror at travis.