Giter VIP home page Giter VIP logo

docker-jvm-talk's Introduction

Add Running a JVM in Docker, a good idea?

Intro

This is a set of resources for understanding the complexities of running your JVM based application inside a linux container, specifically Docker.

I'm doing a talk at the following conferences based on this material:

  • Geecon 2016
  • Devoxx UK 2016
  • Devoxx Poland 2016

Motivation

Why do we want to run our application inside containers?

  • Multi tenancy
  • Consistent deployment format across technology stacks
  • Access to orchestration tools:
    • Kubernetes
    • Marathon on Mesos
  • Using docker for other purposes: CI, dev dependencies

Deployment options

  • Traditional JEE/servelet container: WebSphere, Tomcat running on bare metal
  • Executable jars with embedded Jetty running on bare metal
  • A traditional container inside Docker? Why?
  • Executable jar inside linux container - the sweet spot

Cost savings

// TODO: Show number of servers for single vs VMs vs Kubernetes

What

The best way to work with Docker is to learn a small amount about the underlying kernel features.

Namespaces

Containers are built on top of Linux namespaces. Giving processes their own PID namespace, mounts

PID

TODO:

  • Demo PS inside and outside of the container.

Mount

TODO:

  • Show mounts inside and outside of a container. Show outside where the ones inside map to.

Layered file systems

Users

TODO:

  • Show uids inside and outside of the container.

CGroups

In addition to namepsaces running containers are restricted via CGroups to the amount of memory and CPU they use.

TODO:

  • Show a container with systemd-cfls then systemd-cgtop then put some load and how that cgroup grow.

Docker access to CGroups

TODO:

  • Show options that can be passed to Docker run vs settings on cgroups.

  • memory

  • memory--swap

  • memory-soft-limit

  • oom-kill-disable (Show a java process with this on and not on)

  • cpu-shares

  • cpuset-cpu

  • cpu-mems (for NUMA)

TODO: Show kubernetes docs about squashable resources

Tools>

Top Htop Free // Cotnainer breakdown systemd-{cgtop, cgls} // See namespaces for a process

CAdvisor

Examples

Scenario: to get 1000 TPS for a container.

The logic inside the app containers one HTTP call and one Database call.

Goal is to make our container as small as possible.

Areas to investigate:

  • Memory usage
  • Tuning threads

TODO

  • Count number of threads

Thread per request

A lot of Java web frameworks, Servlets included, use the thread per request execution model.

// TODO Picture of a pool of threads

The popular Jetty servlet container is one such library. Dropwizard is a framework that brings together Jersey with a few other popular libraries.

Dropwizard

Thread per core

Ratpack example

Akka example (Optional)

Demos

  • OOM kill a process with JVM options
    • dmesg
    • docker logs
    • docker restart

TODO:

  • Look at the java swiss army knife

docker-jvm-talk's People

Contributors

chbatey avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.