By Terry Goss, CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=1561215

Things that go wrong when deploying Java with containers

Martin Lehmann

@theneva

FINN.no

(and how to avoid them)

Get to know your app!

  • App config confined to app repo
     
  • Easier to start apps locally and in CI
     
  • Higher dev/production parity
     
  • Automatic horisontal scaling
     
  • Overall improved performance at much lower cost

A tale of CPU and memory

OOMKilled!

  • CPU request = 1 core
     
  • Memory request = 1G
     
  • Memory limit = 1,3G
     
  • Max heap size = 0,6 * Limit = 0,78
  • requestParams.parallelStream()
      .map(…)
    

Have you ever used…

Thread pooling <3 72 CPUs

Java >= 8u131

(April 2017)

 

  • -XX:+UnlockExperimentalVMOptions
  • -XX:+UseCGroupMemoryLimitForHeap

By Chagai at English Wikipedia - Transferred from en.wikipedia to Commons., Public Domain, https://commons.wikimedia.org/w/index.php?curid=3839230

By maix - Based on blank map of Europe.svg, source: Time zones of Europe.png;, CC SA 1.0, https://commons.wikimedia.org/w/index.php?curid=1641488

  • UTC is great!
     
  • Except when locales aren't configured

What can we do?

Know your app before you run it!

  • (How) do you need to tune the JVM?
     
  • Do you have anything that scales by CPUs?
     
  • Which resources does your app really need?
     
  • Make it easy to do the right thing!

Help your developers!

FROM <container registry>/finntech/java8:8

ENV LC_ALL "no_NB.UTF-8"
ENV LANG "no_NB.UTF-8"
ENV TZ "Europe/Oslo"

ENV JAVA_OPTS -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

COPY build/libs/ad-input-server-*.war /app

FiaaS

So: avoid great white sharks by…

  • Knowing your app's requirements and dependencies!
     
  • Making it easy to do the right thing
     
  • Expecting failure, and enabling easy rollback

Martin Lehmann

@theneva (Twitter & Slack)

Come talk to me!

Made with Slides.com