 Okay, you know thanks. Thank you for functioning for this opportunity, you know I tried to select the best picture of Singapore in the evening and with the drill VM for Ruby and you know just to introduce that you know it's from Oracle we are from Oracle Labs based in Singapore and we're working across Asia Pacific Japan and Ruby has been very you know close and dear to a lot of this work that is being done from from Oracle Labs right Oracle Labs was actually started as a successor to Sun Labs and where the research and development arm for Oracle and there are a lot of technologies within Oracle Labs that we work on things like machine learning blockchain and all that from engineering standpoint. Grail VM is the technology that we have had you know special focus in you know from the JVM standpoint also for native images as you will hear and then also interpreters for different languages and one of them being Ruby and so since the last one and a half years we've had Grail VM go into enterprise mode with you know full enterprise production readiness and also of course we have our community support a community version going on as you can see on GitHub and you can follow that and so forth and if any questions you know feel free to pause me you know what I'll do is I'll probably go through a couple of slides and then move into some demos and then you know go back to some of the slides and things like that so we can keep it interactive so just to say if our statement is you know some some of it is forward-looking capabilities and so forth right so so one of the motivations that Grail VM was started initially was that there were these hurdles with multiple run times there were challenges where you know people were trying to devise this parallelism where they want to be able to work across different types of run times you know where you had the Java runtime of course built on hotspot and then JavaScript Ruby and R you know for different purposes everybody has specialization as you were hearing earlier that you know people have different solution skill sets so processing frameworks have different types of bindings for data and machine learning likewise also in the database you want to sometimes have Python JavaScript calls select statements and so forth some of the other challenges that we see there is like performance penalty that happens so when you're crossing over the the boundary of one language to another how many hundred times slower is it functional calls you know the man is it the same memory address space and things like that and then the other part is the management overhead like a lot of heaps you know garbage collection issues policies and then bugs because you have to patch one and then you know you have another third-party dependency and things like that you know how do you how do you do this it becomes very costly cumbersome to maintain this as you grow and scale and things like that right and not to even bring in things like your front-end and so forth so eight years ago what happened was there was a project actually almost ten years ago now there was this project that started out with Dr. Thomas and his team and this concept of one VM to rule them all and started out or collapse and so there's this very nice paper that's written on that if you wanted to see more about what is under the hood like what's behind the scenes the types of optimizations all these things like you know partial evaluation technique inlining and so far why is the performance so good like you will see later okay this is regular Ruby now I'm running it with with with ground VM truffle Ruby and it's so much faster behind the scenes what's going on and so far a lot of it is actually written there and and things like that so you can learn a lot from that as well right so so from growl VM perspective we always think of the you know a love for all languages there was a nice Twitter feed and so forth where you know it was actually shown that you know we have you know support for different interpreters and to recognize that you know in today's mixed environment a lot of people have specialization in different types of languages Java is of course you know pretty significant but of course the rising trend of you know things like you know JavaScript Python Ruby is also very very significant and things like that and then on the right you can see I didn't put the URL here but you know you can actually go directly to get up dot and slash Oracle slash you know growl VM and you can actually see the the different types of actively maintain lines of code that we have got the growl VM project is very active it's got now I think close to about 13 last count was about 13,700 get up stars so you can see in terms of the proportion of the lines of code you know is almost three four million lines of code almost close to a million is on Ruby so it's a large part of it as well so of course support for the languages and things like that as well so the growl VM ecosystem in terms of architecture we've got support for JVM languages as I mentioned you know like things like Java Scala Kotlin and closure and things like that so and on the truffle standpoint what we call this language implementation layer we've got support for JavaScript Ruby are Python and so long so long is more on the CCC plus plus area and things like that so people do that through LLVM bitcode interpreter and then of course it runs on growl VM compiler that is plugged into the hotspot through the JVM CI which is the compiler interface right so that's kind of like a you know simplified architecture in that sense now moving into a truffle Ruby right so so what we've got is this high-performance Ruby implementation right by Oracle Labs and that's the logo I was kind of saying I thought it's very catchy and you know so you know we've got some interesting work going on there so it uses the growl VM JIT compiler growl VM runs in in two modes one is you've got the JIT mode and of course you have AOT which is the head of time and it targets full compatibility with C Ruby including C extensions the open source is on GitHub that's the URL that you can actually follow and bring up you'll be able to see the different areas and demos and things like that the one you're gonna be seeing right now is on that so it runs on two modes right as I mentioned growl VM is in in in the classical sense is it runs in two modes you know you've got the JIT where typically you know you have no more complex long-running workloads so the JVM mode can interoperate with Java conveniently there and also in native mode right which is the default here that you will see it's compiled into AOT which is ahead of time it's a native executable so it's it's you know it's a self everything is pre-compiled in that sense so that's how you get a fast startup and the warm-up and things like that you will see a benchmark that we run and even the low footprint say for example you know your comparing startup you're getting almost like you know two or three times difference 35 milliseconds which is 48 and over the lower footprint like you know 60 megabytes for your RSS memory right and just for a hell of a application and things like that so it's compatibility with different types of CROB 2.6 C extensions is a open SSL and you know a lot of the different drivers and things like that it can reuse a lot of the gem files with no changes and so today from Truffle Ruby's standpoint we are really close to the specs for completeness it's about at 97% and you know compared to CROB and JROB and things like that so all this is actually even shown there let me just kind of go through some you know some of the different goals and status right so currently you can run Ruby code faster so it's doing great in a lot of CPU intensive benchmarks an interesting thing also is that you can run it in parallel so you can run it in multi-threaded mode so there's no limitation there's no Jill or rather the global interpreted lock for Ruby code which is a very welcomed by a lot of different engineers and things like that and you can also do a lot of cross language debugging and profiling so let me just on this note kind of go into some of the the demos right so so what I've got here is essentially a you know just to share with you so you can follow can you see my browser screen here yes yes okay so if you wanted to follow this the easiest way is you just go to the Grail VM site and you can actually download Grail VM run it in parallel it just takes a minute or so to download it it's it's not that long actually and then once you download it you know you just run a GU installed for your for Truffle Ruby and you're already up and running and then you know whatever gems then you need accordingly because everything is self-contained within the Grail VM right all your Truffle Ruby and all that logic and libraries and things like that so assuming you know you have a code something like this right and you know you wanted to write say an application where it has JavaScript in one language but then now you realize there's a library that you need to run which is a third-party library right so say for example you wanted to write your application converting CSS color name to hexadecimal.js but you wanted to use Ruby color library so you've got you know a JavaScript Express and then you know polyglot what we call here's how you mix and match code there's a single runtime on Grail VM and then you know you can run it using your you know Ruby and colors and things like that as well right so so this is where you are basically saying that you know you want to be able to write the application convert it and then do some conversion so you've got you specify some Ruby code as a string and then you realize there's not much in it you just require some libraries and you run the color script and so forth so if we do that we are we are going to be running this and you install some gems so we installed the Ruby and JavaScript dependencies as you normally would and here is the code so if we run this you'll be able to see that it supports that polyglot method right so here is let me just show you what version of Java this is on so this is using basically Grail VM right so the only thing that you do to set this up essentially is you change the home path directory to Grail VM so whatever you've been using before it could be like any JDK or something like that you just change it to this after you download it and that's about it so if I'm in that directory I'm going to be running a node polyglot JVM for color server.js and once that's done you will be able to see you know that color mechanism right that was actually by calling these methods from JavaScript so even though they are Ruby objects and methods we just pass them as a JavaScript you can concatenate the result and so forth so we're doing that here and once this comes up it's a your local host you know we'll just basically go there and you're able to see the color mechanisms right then we can actually change them and things like that as well so let's go to that it's the browser here so let's go to that so you'll see different colors and color schemes and things like that right you know you can then go into you know whatever blue green and things like that as well so so this is how you know it's a very basic example but you know how you're able to install and manage different dependencies and run it in a polyglot style right between JavaScript and Ruby and things like that. Other debugging capabilities that you can do basically would include say for example you know you wanted to run a particular code and then run it on a Chrome debugger right so say for example we ran Ruby and it's a FizzBuzz code and you wanted to create a breakpoint and you know iterate through the code and things like that so if you ran that basically here within this FizzBuzz application so FizzBuzz is as you know it goes through different numbers and the mod sequence and so forth and you print it out so if you run that here let me exit from here so this is a bit more involved you'll see the you know this is basically how you run it in inspect mode so basically GrailVM has a debugger integrated with Chrome DevTools so so this is where you would actually go and you'd actually be able to go through the direct link and if I then paste it in the browser window here you'll be able to see that you know we had a breakpoint there and you can actually step through different functions and things like that right and you know it will give you the breakpoints and you know accordingly the results and things like that so you can actually debug inline within GrailVM into Chrome as well not only just for Ruby code but also for different types of code other languages and snippets and things like that as well so that's a it's a pretty interesting area so then after that you might wonder that you know how is this useful to be doing things like you know more debugging and things like that as well right so so say for example we then you have written a particular Ruby program right say for example you've generated some garbage over time here's a sample Ruby program and if you run like you know all these JVM languages like JRuby and so forth you will see that you want to be able to know more about the underlying objects more information about what's happening and so forth so if you did that you know you are able to run you know your JVM and behind the scene so VisualVM is kind of like a monitoring you know tool that you can do debugging and so forth it's actually pre-integrated with GrailVM these days so you can actually run that so once that's done so let me run that and you'll see that you know it pops up right so you've got the whole interface for VisualVM and so forth so we've got the PID but you know let's make that live right so we run you know obviously a simple application behind the scenes and things like that and then we are basically going to be doing the Ruby program to generate some garbage over time so let's run that so this is a render Ruby code and so you know once that's completed let's run that this is actually generating some area so that on this so once that happens we will be able to see you know details on some of the heap dump analysis and things like that so this is part of the truffle framework earlier you saw in the architecture so you can analyze your your languages that are running on truffle and things like that so once we go back into your Ruby and you're able to see that you know you open that and things like that you're able to see and monitor you know your applications you don't want to see if you consumption GC activity and things like that as well so you can even go down to your meta space you know heap dump analysis and things like that look at your threads live threads and also do things like polyglot sampling and so forth right so that's pretty interesting so you're able to look at your you know Ruby in VisualVM right so and the truffle framework will give you that kind of debugging and analysis capabilities and and things like that as well let's now run a I'm just gonna stop you know if there's any questions feel free to stop because you know I wanted to kind of keep it more interactive for you guys if you have any questions but the next demo I was basically gonna show is on the benchmark right so we're gonna be running a benchmark and what we're gonna be doing here is we have a benchmark we're gonna be using upcarry one is a gaming application that we run it with Ruby and with truffle Ruby and then with obviously a regular Ruby on my Mac and then the second one is kind of like more of a benchmark type application right so so if we run that you'll be able to see that let me exit out of this and so on here you see that if my Java dash version is yeah so basically my Ruby version here would be what's my so here obviously I'm just using Ruby 2.3.7 you see it here the Ruby version would be your truffle Ruby right with the growl VME native so if we ran this kind of benchmark here so this benchmark is a you know basically you have a lot of transactions and iterations per second are going on behind the scenes and you'll be able to have and see a comparison between the two right so if we ran this Ruby benchmark here was your Ruby benchmark with truffle Ruby you'll see a lot more different types of you know the hundreds of thousands of iterations that you can get in the same warming up was this calculating and things like that so it uses WRK tools behind the scenes and so forth for performance analysis and so this will exit out from here and that's kind of like a print out and then generate a .out file and so forth then we compared here you know we run the same you know basically Ruby benchmark on growl VME native and you're able to see you know a larger obviously the number of iterations and so forth going up in terms of into the you know 30 40 hundred thousand and so forth and 689 thousand also into the millions of it in terms of seconds so that's like a simple benchmark comparison right so using some synthetic workloads so you can actually follow how I basically did this over here what it was was how it can really speed up the Ruby code right so yeah what we did is we used truffle Ruby together with growl VME enterprise right so this was kind of like the benchmark that we ran and basically it's a comparison of you know MRI and 2.5 out 3 J Ruby that's the community and then the enterprise and so forth so this goes into the 1 million renders per second right almost 31 times faster and so forth so you can run a lot of that code in parallel and things like that so that's a pretty interesting one another one that I had pre-recorded earlier which I think is kind of cool is Ruby game right so this is something that we did when we were in Japan we were showing this demo if you're interested I can also share this but you know just sort of amusement and so forth so this was something I had prepared I did it but exactly I'd say like one one and a half years ago so so you're running up carrot with Ruby and with truffle Ruby and when I started basically what happens is it will start the game there's a landmaster you know you can go in there and play the game and start it and things like that but this is calculating the frames per second and comparing it you know with Ruby and with truffle Ruby right so I've started this on one screen and then another screen and then you know it props up these these windows right so you can see the speed up on the right hand side on the left hand side kind of frozen in that but you imagine and see what happens in the right isn't that pretty cool so you know so you can actually it'll hit like 138 148 frames per second versus your what's on the your regular Ruby and things like that so these are just some of the different types of examples right that you are able to run accordingly and so forth as well so you know keeping it very interactive and so far you can also build in your own profilers if you wanted to run truffle Ruby for up carrot and look at your profiling you know what was the self-time and also the locations and things like that as well you can actually run that and no issues that's also a rails simpler benchmark right and you can actually get it from GitHub they did a lot of benchmarking on the Ruby 3x3 and they use in WRK for a lot of the benchmarks so Ruby concurrency and you know various configurations and things like that as well so when in this benchmark so we also had another benchmark on the rack app and Puma there's widely used web server and things like that the other one ERB template is more familiar see Ruby so all tests passed on the on for truffle Ruby right for rubies we use the CRuby 2.6 and then truffle Ruby in in JVM mode right concurrency settings were you know in the thumb in terms of three different ones and the request threads and then the rest were all on the same numbers for all so we had same number requests and server threads and then we avoid extra processing and so forth and we maintain one connection right on the server side processor used for this particular one was AMD and that was from frequency scaling and turbo boost was enabled and then ran for 10 seconds so this was a rack and rails application some were ideal and for real well we encourage you to test it in your environment so here were some of the request per seconds differences on the server threads so we see CRuby look at truffle Ruby and you know the difference becoming even larger and larger for you know the threads over time and things like that as well as successive runs and so forth right so almost 120,000 you know request per second and then similarly for when we are able to see it with the processes and things like that here the differences accordingly right so the advantages of threads over processes is that you know you don't need to have the JIT in the program at once not once per process you know you can have common data structures and they can be guaranteed you know no fork pit falls and then you can have faster communication between your threads and your processes and you can synchronize when if you have these needs and so forth so here were some of the results with truffle Ruby with compared to CRuby threads and processes you can see that difference and then some of the future work that we are looking at includes you know running with the you know C extension lock disabled since it is okay to run that in parallel and also for you know your Ruby 3's reactor other 3 C extensions and other thread safe running in parallel and then for truffle Ruby it only matters that if it's synchronized and so forth so you know the Rails benchmark ran on truffle Ruby with a higher limit and the default is sometimes low for Rails and so forth so so splitting avoids some of these calls and so forth as well so this is a this this rack on rails you know applications were you know our you know kind of ideal setting right that we did there were some conditions and assumptions but we encourage you to try it in the real world right for your and share your results and then how you are doing it the best way to get started with truffle Ruby is just to download growl VM you go in there download growl VM run it just like I did earlier and all you do is you know you can have the RVM your Ruby install and you do a GU and you already up and running I'm using 20.2 and things like that as well so that's you know basically just kind of like a high level we've got some other I had also some other basic demos that were running in line and things like that as well but you know that gives you kind of an idea on on where we are at and you know where you can basically go with truffle Ruby and growl VM for Ruby and also then if you're looking at polyglot code so in in in kind of like a summary you know growl VM has this kind of three different areas right you think about it the polyglot where you can have the polyglot context for different languages where you can mix and match earlier what you saw like JavaScript and Ruby that kind of demo and then of course you can run it in GIT which is your just-in-time compiler but growl VM gives you that modern compiler which is enhanced version compared to the regular ones that you see on JDK and so forth so this has all those optimizations like inlining partial escape analysis and partial evaluation built in and then the other ones like in growl VM I hit a time native mode and that's why you see those startup times and the performance and things like that going faster so the best source for all the all the how to run Ruby within a growl VM enterprise is kind of like in this docs here right so you can actually find out how to install it how to run it and what are some of the options available to you and you know what are the options flags and things like that and and you know it can take you accordingly there so you can see all the types of versions you know how you would run the code fast earlier we saw that running in parallel how to boot it in less application time how to run and execute it see extensions in a managed environment and also there's some security aspects to it and you can also have more tooling right for example if you run this this was the deaf tools earlier that I showed and you're able to do debugging using Chrome deaf tools but the interoperability is where you can run it in polyglot context I mean mix and match between different types of languages so here you've got to require JSON I did earlier one which is a bit more simpler but you know you would get results like running this dash dash JVM if you want to run a polyglot program and then you'll be able to see hello world like that several other command line options that you wanted to be able to look at would include you know all these switches and arguments that you can use and and so forth so you can if you're looking at it from a JRuby perspective or MRI perspective and other options and you can actually be looking at and there are very much details on VM options and and so forth and other configuration options that you can run of course debugging and tracing and then so forth as well so that's pretty much what we are what I have hope I didn't go too fast but you know I wanted to you know go less on slides and keep it more interactive for you guys so you know keep the floor open for any questions you guys have thank you Dylan anybody got questions no maybe not curious is how how I actually I'm curious about the polyglot thing like once I'm wondering like is there a lot of take-up rate for that feature and what what do people usually use that feature for yeah I mean performance is one aspect you know that people are doing it but then polyglot what we're seeing a lot of people have specialized skill set so you don't have to the word is you know as you're crossing boundaries between different types of languages those you can the the cost of core of call access could become high security vulnerabilities and so forth so we've had some customers start exploring polyglot you know some were looking at it from a machine learning with with with with you know displaying plotting graphs and so forth so then they use special languages for each one of those and they wanted to all run it on single runtime so a lot of developer productivity was one angle specialization was another angle and you know parallelism and cost was kind of yet another angle where people were going into the you know specifics on code efficiency and so forth as well right yeah actually true now that you mentioned like I can imagine if if all the data science stuff is on Python and then people want to run the Ruby web server and then like rails then potentially they can combine like cross languages yes you're right and it's as easy as you know all you have to do is basically just this polyglot.evl right so you're able to then you do that and you can have this concept of host and guest languages and there's a lot of options that you can do and mix and match this polyglot languages so this is very simple one here right we just run Ruby we can also have like within Java you're calling Ruby third-party or between R where you want to plot something and like you said and so forth as well so it's it's very flexible and it's you know you get that same memory address space and so forth so you know you don't have to be you can then leverage all those optimizations behind the scenes as well so and what do I want to ask I have another question all right no sure whether you mentioned before it is truffle would be like a compile thing like you compile it and then you run it or is it like run like real like real-time running so here we have it you know in this for example if you look at it here on this particular one here so we are using you know we are using it as a as a as part of the native image so you've got that whole AOT aspect the pre-compiled aspect to it so you can also run it in JIT mode or you can write a native mode so you know two options okay cool I don't have any other questions anybody else okay bye yeah I I guess there's no question thank you Dylan for your talk on truffle Ruby today thank you thanks you know thanks for thanks for the invitation and you know I think great to hear that you know the Ruby community is really active in this part of the world and so