 Hello and welcome I'm glad we don't have to overcome this lunch kind of Omar because we can literally eat all day Which does not make life easier for us So my name is Marcus. I'm obviously a German You can follow my remplinks and rantings on Twitter at my fear if you like I do work for redhead and this slide still says developer advocate which is only half of what I do but Let's let's just imagine that I do the speaking thingy regularly if you want to see me and Hear more about me. There's a fair chance. I'll be at one of these conferences or Some more that I've spoken before I do have opinions and I'm a middleware guy and I'm a developer advocate So how is that guy actually supposed to talk about stuff and usually I don't really ramble about myself too long Just want to do a little bit of level setting because there's so much infrastructure talks here So you guys don't ask me the wrong questions later on, right? So I have a middleware history I've been a consultant in the field for almost 14 years before I embarked in sharing my knowledge and speaking at conferences, so when I first came in contact with containers that was actually open shift to dot-axe and and after that I had the pleasure to Embark on this journey throughout open shift where it is today Still keeping a solid eye out on on all the middleware parts and my most favorite language with which is Java, right? So today I brought you a little bit of an agenda I do know that we only have 25 minutes and this is probably going to be the biggest challenge today But I do want to encourage you to ask your questions So if something comes up don't wait for the end don't think for 30 minutes It's just fired well because I do believe that asking questions is the only way to actually learn more So keep that as one lesson from today Yeah containers containers why containers Who's using containers like day-to-day who is actually a software developer employed and earning money? Okay, what are you other guys doing? students Yeah, okay fair enough. So who's who's using containers already? Wonderful, so I'm gonna skip this. It's easy. It's fast It's way better. So just a couple of years ago when I worked for very big German automotive OEMs We had a nice deliverable format for enterprise Java applications anybody want to guess what that was? tar files Surprise surprise and they did not only contain the ear file itself of an application server deployment But also the complete configuration of the application server of choice Which could have been anything blue and red or even redder So it was it was a nightmare and putting this into production Obviously had a bunch of challenges that containers kind of are overcoming these days Which I also like a lot is that our toolbox is Expanding like by the very minute by not being bound to blueprints and corporate recommendations how to use Java the right way in enterprise settings We actually have a fat chance to employ something new something else Because the interface between dev and ops is kind of becoming the container image And if you really think about it We've been living in containers all our lives, right? I mean not at home, but our laptop is kind of a contained environment a virtual machine is a contained environment And now we slimmed that down to the bare minimum and are running it So this is this is a pretty neat way of delivering applications and I'm I'm buying it seriously But is that container and Java think he's still a good idea? I think this is a Google search trend I'm not completely sure if we look at what happened to Java So that when I started my career back in 2002 and even earlier That was still a really really decent language and probably the number one most used language in the enterprise As you can easily see here our choice is broad and right so people are starting to use different things For example go who's using go as a programming language. Yeah, a couple of hands. Who's not using Java on a day-to-day basis Well also four to five. We're getting there, right? Just a couple of years ago when I asked that question in front of an audience every single hand would stay down on the table Because Java was the only choice To me personally This is what I feel about Java This is a nice picture taken by a fellow dev advocate now working for JetBrains And I think it kind of nails what I think about Java and how I wanted to use it So we have Java as a set goal for me personally We have containers as a set goal for companies to run applications going forward Where do I start? I? Think whenever somebody is complaining about Java the first thing they're complaining about Actually is the size of Java itself, right? So just for the sake of comparison I looked at this little slide and you can see the average Docker size image for various JDK base images that are provided, right? So one thing sticks out That is alpine with open JDK 8 But that's that's a that's a huge number like 500 megabytes just for the base image to run our custom applications That's a neat thing Alpine obviously the best among all of them. What do we do with alpine? I Think it's a it's a good way to start development, right? It's a it's a very simple very flat image There are a couple of drawbacks, especially if you run it with anything else than Java 8 So it's a little little red subtitle link You'll find that at the bottom of my slides very often and I call this homework So first of all it's 20 minutes that doesn't really leave me enough of room to dig into individual topics and second of all I only just recently Realized how much I personally hate homework. I Always like in school. It was a tedious task to do But now I have two wonderful girls and they have to do homework Oh god, you have no idea how much I hate homework now So I don't want you to hate it. I want you to pick and choose and match what you're interested in But yeah, find these on the bottom of the slides and I'm promising. I get them to you How else could we try to aim at a very small base image, right? I mean There's another option, which is something from Google This trellis container images It's it's literally complete complete tool set That provides you a really customized stripped down Base image for your applications and actually supports more than Java, but it's it's an interesting way Does size really matter? Does it Is size the only thing we need to care for when we're running Java in containers Don't wake up suggestions hands ideas. I'm not going to let you sleep size actually does probably not matter you already there and The answer is caching right so if we imagine we have an insanely large base image This might even contain an application server of any choice Because it has to and the customer asks for it and you can't use quarkus Then you probably Are going to build a bunch of more images with just 20 Mac of your custom source code for your application the handcrafted Lovely piece that you've been spending your weekends on So the average container size here the average image size Calculated by these 10 images is 118 megabytes if you change the base image a lot and just keep your Custom code the same You end up using a lot more obviously on average So ultimately depending on how you build your images size might matter or it does not Mostly it does a little right so it's important To reduce your image size, but not for the same for the sake of size We need to make sure to reduce risk vectors. We need to make sure to reduce everything that could potentially harm our infrastructures everything that Increases complexity in those applications that we are running right Disc usage itself is not the big problem in clusters What you really need to care about is how effectively can you track these container images? How timely is working with these images? How fast can you update your application code? Just thinking of the software development lifecycle that you now have to go through Imagining that you still build images locally at least for test purposes Seriously, that sucks like Building an image that takes like five minutes. I I don't want to do this regularly and yeah security. I already mentioned Did I mention that I work for Red Hat I do and of course there is something that I Want you to take a look at if you haven't already. There's something that is called the universal base image This is a rel for containers and they're actually a three different flavors that you can use the smallest Flavor actually is roughly 80 megabytes big So if you're really looking for a very small supported container base image that you can use for your Java Applications, this is exactly what you're looking for Advertising if you're looking for a fast registry look at quay Application layers I mentioned so building these images the right ways obviously the key to Building your right Java images in containers If you just look at that simple flow from build to The base image on the top and your application layer on the on the bottom You see that the base images cached anyway most of the time as it should be and Your application is actually sent over again as a new image layer every time if you know start to decompose your application in the way that reflects the Frequency of changes to the individual parts You can even Slim this down to the bare minimum that is needed when it comes to changes and image sizes being pushed by updates Ideally you end up having the smallest layer being pushed for updates which increases your local development experience in just an Unexpressible times right Speaking in docker files that might actually make it a little bit easier for all of us Which means we definitely keep all dependencies that don't change that frequently Hopefully we keep all resources like images whatever you need for your application and We also separate out the application classes the stuff that contains our viable IP great So if we build this for a simple main class in Java you get the ideal image Layering that will definitely improve your development experience on Java Is that all just container size today is all about clouds right so Ultimately cloud to me always is about money Because we have to pay for resources No matter what I do and which awful vendor without open shift. I use You will have to pay for what you do and Java honestly Historically is not really good in resource Restriction resource usage. It's always been optimized for ideal performance and a high throughput So if you look at your Java applications memory usage over time When you start it it takes a while to actually Remba the JVM startup phase. It has a little bit of an overused bubble on top which basically Which basically is an overpeak usage that happens because of garbage garbage collection from the startup phase and Only after the time the JVM kind of comes into swing and gets to the final memory consumption that you actually want to see Why is overpeak usage awful and why don't we want to have startup lag? two questions We've lived with that for ages, right? think serverless Think containers that actually need a spin up for a couple of seconds Do that job and kill themselves controlled by Knative, for example This is probably a really bad scenario for a JVM that actually needs to spin up and Only after a certain time reaches the real warm-up phase, right and overpeak usage That is the stuff you pay for So if you have to assign 500 megabytes more RAM to each individual instance You'll have to pay for that on an hourly basis, right? So if you want to save time and money and if you even want to be able to support workloads that are a little bit more serverless You want something like this? You want to start up that is insanely fast That respect system boundaries and has no overpeak usage in any way And this is saving your money Because you're only paying for what you really get There's a bunch of run times out there people keep asking me what they should use obviously. It's open JDK supported on rail by Red Hat If that is not your answer Here a couple of more For the sake of completeness. I think I Mentioned some here, especially the Oracle one is something that we really shouldn't use anymore Another thing I said overpeak usage is bad Which Java version should we use like can Java control itself? Can a JVM? Accept external assumptions about how much memory or threads or CPUs it has Yeah, obviously not. I mean it can after 8u131 This is actually the first version that is suitable to run in containers because you have a bunch of Compilaflex that you can set that make sure Java is not consuming more resources than are assigned to be in a running part, right? If you use earlier Java versions, you'll frequently see Java out of memory exceptions during runtime because Java just assumes This is mine. I see everything and I want to use it. So Memory configuration I'm definitely going to blow through this because there's no time left More container awareness came in the next Java versions. So somebody in The Java community realized that containers are not going to go away anytime soon Like we all have to accept that microservice thing or serverless. So they started doing a lot more work around container awareness Controlling Java within these resource bound environments, which help us a lot Java 11 took that even a little bit further and if you look into the next versions They'll even be more support around developer tooling. So I think the message these slides are ascending is basically The Java ecosystem cares the people who are hoarding the Java community are pretty much aware that containers are a thing and They are trying to improve the runtime instead of throughput and Performance to actually reflect the requirements that containers put on them, right? Watch out for all these these are actually JDK. I think back numbers It's ultimately always bound to a Java enhancement process kind of entry You want to do troubleshooting and monitoring on the JVM? There's a lot like open shift offers a lot out of the box as the number one wonderful container runtime that you can Even distantly think of but there's also other tools So consider this homework What else do I have? Our typical build process actually changes a little bit This is the slide for the classical Java developer that wants to get into containers Instead of having this one build step. We now have two build steps and a publishing step It's a little bit more like all of us are from from today on releasing maven artifacts, right? This is how it always feels to me pushing an image is some kind of a heavy weight release process Unfortunately, it is what it is and this is the world. We're living in There's only so much we can do about it. I do think that I have a slide You've heard a lot about build our popman and scopio already if you've been to the right talks There's a nice little overview blog post here that really gives you a deep dive Fair warning. All of this does not work on Mac OS or Windows yet. So it's all Linux and rel based Please don't even try if you're using one of these others as a Java developer I Don't like seriously. I don't I don't care. I want to build my software, right? This all is awful. So how to make this life easier our lives easier as Java developers There's a little bit of fabric eight that is still That that is still maintained fabric eight is kind of lingering away, but fabric eight is definitely maintained Spotify thought this is awful because it was not from them. So they created another Docker Maven plug-in awesome There's also just the simple hack to do everything with Maven exec yourself like build your images I don't even think this is not elegant. This is awful And there's Google because they also didn't like what all the others did. They did something new Fair the same for Gradle Other players, I guess you can mix and choose and match whatever suits you best. It's your little build help us If you're completely up to speed and in the microservices kind of ecosystem and you really want to build small services You don't want to build your images every time you want to have an awesome developer experience You absolutely need a look into Quarkus as a framework It is not mitigating all the problems Java has but it's mitigating your developer life because Everything is so much simpler if you haven't looked at Quarkus yet This is like the number one homework to take home because I'm going to test you about it Odio If you have open shift if you're lucky enough You can definitely use something that I call a developer CLI and that this is recorded But I'm still saying I love the CF push experience, right? Have you ever played around with Cloud Foundry like back in the days when it was still famous? People could just push their local project into the cloud and worked This is for open shift, right? If you don't want to mingle around with QCTL or whatever. It's called these days This is your solution We also have a bunch of IDE Integrations that make your life so much easier VS code IntelliJ Even Microsoft is picking that stuff up and putting it into the Azure DevOps because open shift also runs on Azure, obviously If there's some IDE missing here that you want support for please don't hesitate to send me an email more than happy Want to learn more than I could just push out in 20 minutes with 150 slides this is your go-to point to register Developers to redhead.com has everything you ever wanted when it comes to redhead technologies Their developer licenses for rel that is open shift Container code ready containers that you can download and have your little own open shift on your laptop Yeah, register. It's free somebody said Put this slide up and I'm yeah, okay. We'll do I'm actually a rehire in redhead. So I've been at redhead four years ago Did a little bit of exploring on the West Coast and US based startups that was super interesting I learned a lot, but the one company I couldn't stop thinking about coming back towards redhead here I am. Thank you for having me if you want to have that same kind of community experience, please Visit us come to the booth. Thank you questions So fair warning I won't be around for long because I have to drive back to Munich five and a half hours But as I said, I've been taking questions on Twitter DM me DMs are open Marcus is at redhead is my email So if something's not been covered if I did something awfully wrong that you know better about also, please feel free to reach out Thank you so much. Have a wonderful rest of the conference