Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
Running Java applications on Docker: practical tips and valuable insights
Fernando BabadopulosTail
@babadopulos
MEMORY ALLOCATION
Exception inthread...java.lang.OutOfMemoryError:Javaheap space
• By default, container will use as much memory and swap as possible
• Can be restricted using -memory, -memory-reservation, —memory-swap
• Java SE 8u121 and earlier : unaware of container’s limited resources
• From Java SE 8u131 and in JDK 9: there is support for cgroup
CPUs and Threads
Estimating PIusing the MonteCarlomethod
0 1
1
πr2 =π/41x1=1
Ntotal
=
π ≈4 Ntotal
LD_PRELOADHack
RANDOM NUMBERS AND SECURITY
haveged - asimpleentropydaemon
DEBUGGING APPLICATIONS
INTEGRATION TESTS
STRATEGY:
- ONE DOCKER-COMPOSE.YML FOR THEAPPLICATION, ANOTHER ONE FOR TESTING
- START SERVICES- RUN APPLICATION- RUN INTEGRATION TESTS- STOP SERVICES
CODE AT
HTTPS://GITHUB.COM/BABADOPULOS/DOCKER-JAVA-ISSUES-DEMO/TREE/MASTER/INTEGRATION-TESTS-SAMPLE
REFERENCES:
Java inside docker: What you must know to not FAIL, byRafael Benevides
HTTPS://DEVELOPERS.REDHAT.COM/BLOG/2017/03/14/JAVA-INSIDE-DOCKER/
CONVERSATIONS WITH ELIJAH ZUPANCIC (@SHITSUKOISARU)
LD_PRELOAD HACK:HTTPS://STACKOVERFLOW.COM/QUESTIONS/22741859/DECEIVE-THE-
JVM-ABOUT-THE-NUMBER-OF-AVAILABLE-CORES-ON-LINUX/22762558#22762558
HTTPS://GITHUB.COM/BABADOPULOS/DOCKER-JAVA-ISSUES-DEMO
Running Java applications on Docker: practical tips and valuable insights
Fernando BabadopulosTail
@babadopulos