Use OpenStack to run Java programs inside a Docker container

50 %
50 %
Information about Use OpenStack to run Java programs inside a Docker container

Published on January 30, 2016

Author: ianuzzo

Source: slideshare.net

1. Use OpenStack to run Java programs inside a Docker container SEBASTIANO MIANO TESINA PROTOCOLLI E ARCHITETTURE DI ROUTING 1/2430/01/2016 17.12

2. Outline • Problem presentation and proposed solution • Implementation steps • Performance Analysis • Final Considerations 2/2430/01/2016 17.12

3. OpenStack OpenStack is a free and open-source cloud computing software platform. Users primarily deploy it as an infrastructure as service (IaaS) solution. 3/2430/01/2016 17.12

4. VM migration: use case 4/2430/01/2016 17.12

5. Hypervisor VMs vs. LXC vs. Docker LXC 5/2430/01/2016 17.12

6. VM migration: Docker 6/24 …also 400-500 MB 30/01/2016 17.12

7. Migrate Java programs instead VM 7/2430/01/2016 17.12

8. VM migration problem: solution 8/2430/01/2016 17.12

9. Implementation steps Modify OpenStack so that recognizes this object (JAR) and lunches this object inside a Docker container with a JVM. Create a bridge in C using libpcap library that forwards packets between 2 vNIC. Integrate the previous prototype in Java. 9/2430/01/2016 17.12

10. OpenStack and libvirt In order to interact with the virtualization capabilities of VM, OpenStack uses the libvirt and its corresponding API to deploy an instance on the compute node. 10/2430/01/2016 17.12

11. OpenStack and NovaDocker 11/2430/01/2016 17.12

12. Transfer instance (JAR) from Glance The Glance project provides a service where users can upload and discover data assets that are meant to be used with other services. This currently includes images and metadata definitions. os_command_line 12/24 image_id 30/01/2016 17.12

13. OpenStack and NovaJar In order to load the Jar inside the Docker container and run it I developed two solutions: 1. The first one uses docker data volumes to mount a Host Directory as a Data Volume. 2. The second one uses the new exec command included in the docker API 1.15 that allows to run a command inside a running container. 13/2430/01/2016 17.12

14. Solution with Data Volumes With this solution I transfer the jar image in the host directory and when NovaJar receives a request from scheduler mount this directory in a directory on the just created container. 14/2430/01/2016 17.12

15. Solution with Exec Command With this solution I need to start the container and after that I have to inject the JAR image inside the container. There are not “official” solution to do this when a container is already running, but I solved this problem by copying the JAR retrieved from glance in this path -> /var/lib/docker/aufs/mnt/{container_id}. After that I use the exec command to run the jar inside the container. Docker REST API exec /var/lib/docker/aufs/mnt/{container_id} 1530/01/2016 17.12

16. Data Volumes VS Exec Command Data Volumes • Good: ― Uses a feature of Docker’s API in order to use the JAR inside the container ― If the JAR does not use the network is possible to start it at container boot. Exec Command • Good: ― Allows a user to spawn a process inside their Docker container via the Docker API. • Bad: ― If the JAR uses the network (all times) the “pure” solution does not work because when the container starts the network is not yet available. • Bad: ― The command started using docker exec will only run while the container’s primary process is running. ― Uses an “unofficial” solution in order to inject the JAR inside the container (other solution: Dockerfile). 16/2430/01/2016 17.12

17. Third solution: merge of the previous Data Volumes and Exec Command • Good: ― Uses a feature of Docker’s API in order to use the JAR inside the container ― Allows a user to spawn a process inside their Docker container via the Docker API. • Bad: ― The command started using docker exec will only run while the container’s primary process is running (requires container already running). 17/2430/01/2016 17.12

18. Changes to the controller: Nova-scheduler Nova-scheduler is the module on the controller node that decide on which host run the instance selected. There are some standard filters available in nova.schedule.filters. We have to enable the ImagePropertiesFilter. It filters hosts based on properties defined on the instance’s image. It passes hosts that can support the specified image properties contained in the instance. In particular it filters hosts based on the architecture, hypervisor type, and virtual machine mode specified in the instance. os_command_line hypervisor_type = nova_jar 18/2430/01/2016 17.12

19. Performance Analysis First JAR output 0.129 Retrieve JAR (4 KB) 0.207 Start Container 0.707 Create Container 0.167 0.167 0.707 0.207 0.129 TIME(S) START JAR BRIDGE 19/2430/01/2016 17.12

20. Performance Analysis 0 1 2 3 4 5 6 7 8 9 10 1 NIC 2 NIC 4 NIC 6 NIC 8 NIC 12 NIC Time to start container Container creation Container start Retrieve JAR First JAR output 0 1 2 3 4 5 6 7 8 9 10 1 NIC 2 NIC 4 NIC 6 NIC 8 NIC 12 NIC Total Time Total Time 20/2430/01/2016 17.12

21. 21/24 Performance Analysis 30/01/2016 17.12

22. Final Observations 22/24 • Transfer JAVA programs is better than transfer VM images - not only java programs • Use the hybrid solution (volume + exec) is better - use only “official” API • Container start problem - OVS? • Container start delay can be solved - use a container already running - attach vNIC in this container at runtime • Nova-docker driver still under development - great start, but additional features needed for parity - additions to nova-docker driver could change cloud performance • Docker is still under development30/01/2016 17.12

23. JavaBridge and libpcap wrapper 23/24 eth0 eth2eth1 Java Bridge Docker Container JNI 30/01/2016 17.12

24. Thanks for your attention! 24/2430/01/2016 17.12

Add a comment

Related pages

Docker - OpenStack

A Docker container includes a software ... Once you configured Nova to use the docker ... The containers team may be found in #openstack-containers.
Read more

How to run a Ceph file system inside a Docker container ...

Learn how to use Docker to run Ceph, ... How to run a Ceph file system inside a Docker container. Running Ceph inside Docker.
Read more

Docker - Build, Ship, and Run Any App, Anywhere

Partner Programs; AWS; IBM; Microsoft; Partner Portal; ... Docker runs any app, anywhere. ... Docker Use Cases.
Read more

java - Docker Hub

Compile your app inside the Docker container. ... the Java tar manually from oracle.com and then use java-package to ... docker run -it java ...
Read more

OpenStack - Docker Docs

Docker container networking Work with ... Dockerfile reference Docker run ... --openstack-domain-name or --openstack-domain-id: Domain to use for ...
Read more

Atlassian Blogs

Below I will provide an example of how to use Docker to deploy a Java application inside a container. I’ll use Stash ... Deploy Java Apps With Docker ...
Read more

Docker Docs

Use the Docker command line ... Work with a development container Run tests and test documentation ... Docker Machine automates container ...
Read more

Home » OpenStack Open Source Cloud Computing Software

Open source software for creating private and public clouds. OpenStack software controls large pools of compute, storage, and networking ...
Read more