1
00:00:00,000 --> 00:00:04,720
here's what i wanted to talk about ben today we might only have a little bit of time because you

2
00:00:04,720 --> 00:00:08,440
and i have just used a lot of time to catch up with each other it's always a pleasure this is

3
00:00:08,440 --> 00:00:12,500
the thing that that they you know you get about your uh your random coffee donut time what did

4
00:00:12,500 --> 00:00:19,620
they call that in zoom have uh remember in zoom in slack there was this movement among the the

5
00:00:19,620 --> 00:00:24,280
the nerdy people to have like you'd set up this slack bot and it would randomly assign someone to

6
00:00:24,280 --> 00:00:28,580
have a donut with or something wasn't because it was called the donut channel or something

7
00:00:28,580 --> 00:00:35,720
i don't know anyways it's good to have donuts with people uh and and to plan that out but i've

8
00:00:35,720 --> 00:00:41,200
been helping out you know we've got uh we we've moved our our SpringOne conference to a virtual

9
00:00:41,200 --> 00:00:47,000
conference so that more people can attend which i think will be great uh because it becomes very

10
00:00:47,000 --> 00:00:50,800
easy if you're interested in attending i'm not i don't even have a discount code because it's free

11
00:00:50,800 --> 00:00:55,560
now you can go to spring1.io now you could try to use the discount code i don't know where you would

12
00:00:55,560 --> 00:01:01,540
type it but if you want to you can use the code Coté free uh and i assume it will make it free

13
00:01:01,540 --> 00:01:05,620
since it already is free you see how that i have a philosophy degree so i know how to do uh you know

14
00:01:05,620 --> 00:01:13,280
if a then b and b then c then i can do logic i forget what the upside down es and a's mean uh but i

15
00:01:13,280 --> 00:01:18,960
could probably look at my notes from school anyhow i've been going through and helping out with some of

16
00:01:18,960 --> 00:01:23,200
the uh the kind of arranging the agenda and this thing keeps coming up over and over again called

17
00:01:23,200 --> 00:01:29,200
growl vm and i just can't help but say it that way and i know that's associated with spring native

18
00:01:29,200 --> 00:01:34,160
and this stuff has been going on for a while so i was hoping maybe you could educate me on what all

19
00:01:34,160 --> 00:01:38,880
of that stuff is because i know you keep doing these videos on python and dot net but i know you're a

20
00:01:38,880 --> 00:01:45,020
java person at heart right so you must be as you drift off to sleep at night dreaming of donuts

21
00:01:45,020 --> 00:01:51,320
you're probably like growl growl and just dreaming of this stuff because it sounds awesome so what's

22
00:01:51,320 --> 00:01:57,220
going on with this java native business yeah it's really quite cool it's um you know for folks who've

23
00:01:57,220 --> 00:02:04,040
been around java for a while they'll have heard the term java virtual machine for example and um they'll

24
00:02:04,040 --> 00:02:11,180
uh you know most folks are used to running programs on their on their computer uh you know if you

25
00:02:11,180 --> 00:02:16,620
imagine you're in the command line uh in windows if you want to see all the files that are in a folder

26
00:02:16,620 --> 00:02:21,680
you type dir that's a program right and that program executes really quickly gives you a full list of

27
00:02:21,680 --> 00:02:28,340
everything that's uh on on that particular folder in mac and uh you know uh linux and it's ls but

28
00:02:28,340 --> 00:02:34,740
essentially you know it's a program right all those things are programs java virtual machine and java

29
00:02:34,740 --> 00:02:41,060
programs though they work differently they need a virtual machine in order to operate so um you need

30
00:02:41,060 --> 00:02:48,500
this like um middle layer that takes the java code and turns it into something that can be run on the

31
00:02:48,500 --> 00:02:54,900
machine that you're on it's very flexible because it means that you can uh you know have a java virtual

32
00:02:54,900 --> 00:03:01,000
machine for mac os and for windows and for linux and you can um run that even on different um

33
00:03:01,000 --> 00:03:08,360
architectures arm or uh or intel or whatever but there's uh there's a problem with having all that

34
00:03:08,360 --> 00:03:14,760
stuff in the middle you know it can make things a little bit heavy and uh it can like my middle am i right

35
00:03:14,760 --> 00:03:25,640
no no no no your middle is just fine oh thank you but what yeah so you end up with this sort of extra

36
00:03:25,640 --> 00:03:32,400
layer and that can there are some use cases where that's a disadvantage right not many because

37
00:03:32,400 --> 00:03:38,180
obviously java is huge and it's been very successful but there are some use cases where that's a

38
00:03:38,180 --> 00:03:45,300
disadvantage so having something that works more like a a native program like that dir or ls where

39
00:03:45,300 --> 00:03:51,060
you know it's instant and it's quick and it has a low memory footprint it's very high performance

40
00:03:51,060 --> 00:04:02,000
that sort of native use of a program is quite attractive for certain use cases a good example

41
00:04:02,000 --> 00:04:08,020
might be something like serverless where in order to be able to react quickly it's really helpful if

42
00:04:08,020 --> 00:04:14,940
your workload can start very quickly so if you want really fast start times then starting a java

43
00:04:14,940 --> 00:04:21,960
virtual machine going through um the byte code and and compiling that so that it will run um on that

44
00:04:21,960 --> 00:04:27,800
machine takes a while um maybe you don't want that in that particular use case maybe you want

45
00:04:27,800 --> 00:04:35,300
something faster so that's what graal vm does so to to summarize it's basically i mean i feel like

46
00:04:35,300 --> 00:04:40,260
java has tried to do this over the years so many times but like it basically

47
00:04:40,260 --> 00:04:47,440
this is the wrong word but but well maybe it's not it basically it compiles down your java code into a

48
00:04:47,440 --> 00:04:53,460
single executable that doesn't have the java vm it actually makes it because the java vm takes your

49
00:04:53,460 --> 00:04:59,040
bytecode and does that for you kind of on the fly-ish sort of that's inaccurate but it does

50
00:04:59,040 --> 00:05:05,020
eventually you always get this this uh executable code that has to run but in this case it's like

51
00:05:05,020 --> 00:05:12,060
well why not just do it from the get-go and i you know it must have been very difficult to make that

52
00:05:12,060 --> 00:05:20,220
happen over the past 25 years is that how long it's been uh so and and the reason why that's valuable

53
00:05:20,220 --> 00:05:25,020
other than just being cool is like well sure it's good to have you know nice startup times but

54
00:05:25,020 --> 00:05:30,740
especially if you're looking to do like a cloud native style architecture especially if it's running

55
00:05:30,740 --> 00:05:39,400
in kubernetes where each component of your application has very little guarantee of living long

56
00:05:39,400 --> 00:05:43,980
i guess i guess you could always say you can tell kubernetes not to destroy it but

57
00:05:43,980 --> 00:05:50,040
the intention is that your application architectures will have a bunch of ephemeral components that come

58
00:05:50,040 --> 00:05:57,620
and go as makes sense to kubernetes so if if you're writing like a java application uh your little java

59
00:05:57,620 --> 00:06:02,240
bits are going to be coming and going all the time if you've architected it that way yeah and there's

60
00:06:02,240 --> 00:06:07,260
another there's another quite interesting use case there especially for folks running you know kubernetes

61
00:06:07,260 --> 00:06:15,320
at scale and that is that when you go through this process of creating a native image with graal vm

62
00:06:15,320 --> 00:06:24,080
from your java code um because you're sort of losing some of that um chunky middle that we were talking

63
00:06:24,080 --> 00:06:32,420
about earlier uh it means that you can sometimes also benefit from other impacts of that like lower memory

64
00:06:32,420 --> 00:06:39,840
footprint so if you imagine you've got a thousand containers and you manage to lower the memory footprint on

65
00:06:39,840 --> 00:06:48,320
those containers a little then your cloud bill will reduce so it's also sort of a cost saving measure in

66
00:06:48,320 --> 00:06:56,440
some cases as well it's not perfect because you if an application needs a lot of memory anyway naturally

67
00:06:56,440 --> 00:07:02,000
because it has a lot of data to work with or whatever it's not going to be hugely lighter but

68
00:07:02,000 --> 00:07:08,980
for some applications by sort of stripping away some of that stuff that's in the middle uh the the just

69
00:07:08,980 --> 00:07:14,660
in time compiler and all the other stuff that's in there you can um see a reduction in the memory

70
00:07:14,660 --> 00:07:21,380
overhead as well okay so it does have definite um cost implications for those who are running at scale

71
00:07:21,380 --> 00:07:28,000
as well i think okay okay and so then so the second part is like so so thus far we've mostly talked

72
00:07:28,000 --> 00:07:33,020
about like the concept of it and not concept as in it doesn't happen but like generically what it is

73
00:07:33,020 --> 00:07:40,520
but what what's up with like graal vm as its own thing right like are there many different like java

74
00:07:40,520 --> 00:07:45,760
native things out there and this is just one of them or like is this the only way of doing it or like how

75
00:07:45,760 --> 00:07:52,900
does that as a as a i don't know if you would call it a brand but how does it as a brand as a project

76
00:07:52,900 --> 00:07:59,420
as a product fit into all of this i definitely say it's the most well known i understand that there were

77
00:07:59,420 --> 00:08:08,460
other projects in the java community to also do um a similar thing and um i'm not sure what the status

78
00:08:08,460 --> 00:08:13,560
is of those projects so i probably shouldn't really comment on them but um but yeah i doubt it would be

79
00:08:13,560 --> 00:08:20,720
alone because it's such a big community there's always room for alternative implementations of similar

80
00:08:20,720 --> 00:08:28,240
ideas there's also um you know graal vm is is associated with oracle so so there's there's sort

81
00:08:28,240 --> 00:08:35,520
of a a paid version and a and a kind of a free tier if you like as well so there are different licensing

82
00:08:35,520 --> 00:08:42,100
implications sometimes with uh with with graal vm too so you need to sort of figure out if it's the

83
00:08:42,100 --> 00:08:49,380
right thing to do for your workloads probably it's the right thing to do for some workloads but perhaps

84
00:08:49,380 --> 00:08:54,300
not for all workloads there are other constraints as well right right and and then and then my

85
00:08:54,300 --> 00:09:01,600
understanding is they oracle contributed to the to like open jdk back in october now i i i know that i

86
00:09:01,600 --> 00:09:07,180
am not up to date enough on like community open java community open source stuff so i don't want to like

87
00:09:07,180 --> 00:09:14,800
step down that path maybe one day i'll go research that i remember way back when when i was still an

88
00:09:14,800 --> 00:09:21,800
analyst at red monk i i i knew all of that very well when sun was uh going to oracle and everything but

89
00:09:21,800 --> 00:09:30,020
nowadays i'm not really sure what the deal is but okay so so graal vm is basically oracle's uh

90
00:09:30,020 --> 00:09:38,620
implementation of doing um native java and and as i was just saying they've contributed to open jdk so

91
00:09:38,620 --> 00:09:46,100
if use open jdk i i assume that means it's in there which is great so essentially most any you know if

92
00:09:46,100 --> 00:09:51,800
you're doing java development you you have access to it now we and in the spring community they have

93
00:09:51,800 --> 00:09:58,780
spring native which which works with graal vm and um i mean i guess what i was wondering about that is

94
00:09:58,780 --> 00:10:10,280
like like what is what by the nature of doing native java would why does spring need to be involved in

95
00:10:10,280 --> 00:10:16,180
that like because it seems like it might be like you just do you just pass in this one it's always

96
00:10:16,180 --> 00:10:21,820
some hyphen uppercase x flag that you pass in or at least in my day it was but you just pass a flag

97
00:10:21,820 --> 00:10:25,780
into the compiler and you're done but like so what why does spring have to be involved with it

98
00:10:25,780 --> 00:10:31,300
right so remember we were talking about the java virtual machine the way that it works it is very

99
00:10:31,300 --> 00:10:39,720
flexible you can do things like modify the class path for something um which would add additional

100
00:10:39,720 --> 00:10:45,480
features into your application for example so oh that was very very well explained of what a class path

101
00:10:45,480 --> 00:10:50,800
does you really uh you really removed all the jargon out of it and just explained the outcome

102
00:10:50,800 --> 00:10:59,180
well anyone who's run a minecraft server and adds a modification right a mod uh they will be adding

103
00:10:59,180 --> 00:11:08,240
extra programs i guess that's true right so so you know it's so anyway so putting that aside for a

104
00:11:08,240 --> 00:11:15,360
second there's a problem and and the problem is that um in order for things like graal vm to be able

105
00:11:15,360 --> 00:11:23,360
to create your native application it does static analysis on the code base to find out which

106
00:11:23,360 --> 00:11:31,460
avenues through the code are used and then compile those into native machine code that can run natively

107
00:11:31,460 --> 00:11:36,620
right and and this may not be extremely accurate so maybe it's more of a metaphor but to put it the

108
00:11:36,620 --> 00:11:44,940
other way is it cuts out all the code that's not used it does and it needs to know ahead of time

109
00:11:44,940 --> 00:11:51,820
all the code that is used and that's a problem because java has quite a lot of flexibility here

110
00:11:51,820 --> 00:11:56,940
there are things like reflection there are external files that you might need to know about there's all

111
00:11:56,940 --> 00:12:02,360
sorts of other stuff that also comes along with a java application that you might not know about

112
00:12:02,360 --> 00:12:08,140
um and that graal vm might not know about just by having a look at your main class and then figuring

113
00:12:08,140 --> 00:12:15,100
out you know what it thinks are the code paths so that causes a problem for lots of um frameworks

114
00:12:15,100 --> 00:12:19,420
uh including spring so there's been an awful lot of work done in spring

115
00:12:19,420 --> 00:12:30,940
to um bring in some new um innovations that allow that particular style of static code analysis to work

116
00:12:30,940 --> 00:12:37,200
correctly with frameworks where where flexibility is the name of the game you know spring has been

117
00:12:37,200 --> 00:12:47,120
flexibility is one of its major benefits is um inversion of control and um ahead of time uh uh sorry um

118
00:12:47,120 --> 00:12:55,760
behind of time yeah yeah yeah there's probably some better phrase for it than that it's december

119
00:12:55,760 --> 00:13:02,700
i'm struggling i need to hibernate uh but yeah there's a whole bunch of stuff that you need to

120
00:13:02,700 --> 00:13:12,880
know about that that um that is done more um dynamically in in java and in frameworks that rely on java like

121
00:13:12,880 --> 00:13:18,100
like spring so there's been an awful lot of work done in spring to make it compatible with that style

122
00:13:18,100 --> 00:13:26,200
of static code analysis ahead of time analysis so that um that you can still write your code and use it in

123
00:13:26,200 --> 00:13:31,240
uh in your in your application but there are there are still some caveats there there are still some

124
00:13:31,240 --> 00:13:37,140
things that you um perhaps won't be able to do so it's not suitable for every application yet

125
00:13:37,140 --> 00:13:42,120
but the compatibility is growing and growing and growing and with spring boot three

126
00:13:42,120 --> 00:13:49,160
and spring framework six um the compatibility is at such a stage where it's generally available for

127
00:13:49,160 --> 00:13:54,500
everyone yeah and and i get you know i guess i guess to make try to make another example like

128
00:13:54,500 --> 00:14:01,620
uh if if you you know it's possible in java and definitely in spring to say like all right i have

129
00:14:01,620 --> 00:14:09,620
a a p i'm going to generate a pdf of this feature i want i want uh i want to generate uh ben's internet

130
00:14:09,620 --> 00:14:14,940
bill so he can file a reimbursement to get home internet reimbursement which i i probably need to go do

131
00:14:14,940 --> 00:14:21,420
before it gets too far behind so in in my program i need something that generates a pdf and you could

132
00:14:21,420 --> 00:14:26,760
at at building you know when you're writing the software you could decide that i want to use this

133
00:14:26,760 --> 00:14:30,680
pdf engine and so you just put it in there and then your java native stuff is just going to pick

134
00:14:30,680 --> 00:14:35,920
out what it needs from the pdf engine or you could also say like i don't know i might want to swap in

135
00:14:35,920 --> 00:14:40,960
and out pdf engines depending on whatever and so even though you've compiled the code you can use some

136
00:14:40,960 --> 00:14:47,340
the the the dynamic loading that java has to like bring new pdf things in and not and like so you've

137
00:14:47,340 --> 00:14:51,980
got uh i don't know if that example fits because maybe that's taken care of by like graal vm stuff but

138
00:14:51,980 --> 00:14:57,720
the point being that you can like actually change if if you're going to be doing things where you're

139
00:14:57,720 --> 00:15:02,880
changing the actual code that's running somewhere things get a little dicey if you needed to pre-compile

140
00:15:02,880 --> 00:15:08,380
everything by yeah there's no for example those mods we were talking about for minecraft they just

141
00:15:08,380 --> 00:15:14,020
wouldn't work in this scenario because it's uh it's statically compiled you have to reboot the server

142
00:15:14,020 --> 00:15:18,980
basically well i guess you did not only reboot it you'd have to recompile it you'd have to include

143
00:15:18,980 --> 00:15:25,720
all of that stuff from the start you couldn't just patch it on later as an additional jar right so the

144
00:15:25,720 --> 00:15:32,000
class paths are fixed for example so if you have a situation where you can't have a fixed class path

145
00:15:32,000 --> 00:15:37,420
then probably this style of compilation is not not for that particular work though there you go that's

146
00:15:37,420 --> 00:15:42,200
that's a good a good uh shorthand way of thinking about it in the java world is that like if you're

147
00:15:42,200 --> 00:15:49,520
doing not a native java you can't ever mod you can't modify the class path like and you can't even

148
00:15:49,520 --> 00:15:55,080
restart it you just got to recompile everything which which uh you can't modify it dynamically as you

149
00:15:55,080 --> 00:15:59,720
yes yes exactly as you can with regular java yeah you could you know with regular java it's just part

150
00:15:59,720 --> 00:16:06,000
of the command that you'd use to start the jvm but with um a graal vm image it's more like you can't

151
00:16:06,000 --> 00:16:14,060
modify the dir command right because it's fixed it's it's code is it's code and it doesn't change at

152
00:16:14,060 --> 00:16:19,660
runtime whereas java is more flexible but that flexibility causes it challenges in other

153
00:16:19,660 --> 00:16:25,520
other ways but the graal is great as well i mean in terms of you know speed up

154
00:16:25,520 --> 00:16:32,400
um i've seen from my own sort of messing about with it a while ago that if you had an application

155
00:16:32,400 --> 00:16:39,500
that maybe took three seconds to start you probably start it in 0.3 seconds so so like a

156
00:16:39,500 --> 00:16:44,960
at least a tenfold increase in start yeah that's crazy and that's conservative sometimes you know

157
00:16:44,960 --> 00:16:50,300
does does the uh does the compiling time take longer how does it affect that it does yeah yeah

158
00:16:50,300 --> 00:16:57,420
the compile time is longer and um one thing if you know for folks wanting to maybe scratch the surface

159
00:16:57,420 --> 00:17:04,140
a great way to do it is with spring boot because everything that you need is included in the uh tools

160
00:17:04,140 --> 00:17:08,380
that you use to build with spring boot so if you're used to maven for example and you normally use

161
00:17:08,380 --> 00:17:15,100
um you know spring boot colon run to run your applications you can use spring boot colon native

162
00:17:15,100 --> 00:17:21,160
image to build a native image and the documentation is fabulous the documentation for spring boot 3 i've

163
00:17:21,160 --> 00:17:25,880
just been looking through it this morning and it's really really good yeah so folks will find it very

164
00:17:25,880 --> 00:17:32,340
easy to get started if they want to give it a try well that's great i feel i feel as educated as i

165
00:17:32,340 --> 00:17:37,940
need to be which i think is uh that's not always like how you get an a plus but it uh it'll get

166
00:17:37,940 --> 00:17:44,040
you by in life i think but you know i i i don't know this for sure but no doubt at our SpringOne

167
00:17:44,040 --> 00:17:48,760
conference if you're interested in grawl and spring native i bet i bet hopefully maybe i should go check

168
00:17:48,760 --> 00:17:54,060
and suggest if we don't have this but we should have uh plenty of content going over this stuff uh

169
00:17:54,060 --> 00:17:59,800
which there is there is i've seen it already i think there is which uh yeah i'm being kind of

170
00:17:59,800 --> 00:18:06,840
facetious but uh hey are you doing are you doing a watch party do you know oh yes i don't know if

171
00:18:06,840 --> 00:18:11,320
that's if that's supposed to be some sort of like i don't know why it would oh is it super secret

172
00:18:11,320 --> 00:18:19,400
squirrel okay no no no way i mean i i if if it is i i should advise someone that like you know there's

173
00:18:19,400 --> 00:18:24,500
whatever uh yeah we have we'll have one in the uh i don't think there's a way for you to register for

174
00:18:24,500 --> 00:18:29,880
it or whatever no no no i'm supposed to be hosting one like in the amsterdam office uh to to watch the

175
00:18:29,880 --> 00:18:35,480
stuff which will be fun i'll have to think of some speeches to give uh maybe raise up i'll raise up a

176
00:18:35,480 --> 00:18:41,620
glass of coffee well do share i'm doing the i'm doing the london one so oh that'll be fun do share

177
00:18:41,620 --> 00:18:47,400
yeah yeah yeah that's good well well speaking of that if you're interested you can you can attend

178
00:18:47,400 --> 00:18:53,460
SpringOne for free if you go to SpringOne.io and uh you can find out about all of that stuff

179
00:18:53,460 --> 00:18:58,180
uh you know and you can tend it i forget which dates it is in january but it's it's kind of in

180
00:18:58,180 --> 00:19:04,320
the third week of january maybe yeah 24th i think yeah but it just go to SpringOne.io i'll put a link

181
00:19:04,320 --> 00:19:09,320
in the uh the show notes here and you can check it out and with that we have a bit of a short one here

182
00:19:09,320 --> 00:19:16,360
you gotta wrap it up to go meet an old colleague downtown uh but yeah uh you know if you're interested in

183
00:19:16,360 --> 00:19:21,680
the the show notes for this you go to tanzutalk.com you can subscribe to the podcast you can check out

184
00:19:21,680 --> 00:19:26,820
videos that we do there or uh if you've watched this and uh you know you can also watch us do it

185
00:19:26,820 --> 00:19:34,360
live and youtube and twitch and linkedin twitter all over the place we're everywhere you want to be

186
00:19:34,360 --> 00:19:38,520
wait that was a slogan for some company back in the 80s was that at&t maybe

187
00:19:38,520 --> 00:19:42,740
uh don't know they don't operate in the uk so what

188
00:19:42,740 --> 00:19:53,640
uh let's just go with yes yeah what what was what was the name of of bt's like logo didn't they have

189
00:19:53,640 --> 00:19:59,120
like a little mascot and and it's got some name oh i see you know you're giving away my age now but

190
00:19:59,120 --> 00:20:04,720
i think it was buzzbee i think it was buzzbee or something like you know give us a buzz oh that's

191
00:20:04,720 --> 00:20:11,440
nice something like that okay all right well with that we'll see everyone next time goodbye bye bye

192
00:20:11,440 --> 00:20:11,720
Bye.
