Garbage Collection

Summarized using AI

MagLev - From Download to Deploy

Johnny T • March 17, 2014 • Earth

In the presentation titled "MagLev - From Download to Deploy," Johnny T discusses MagLev, a Ruby implementation built on top of the GemStone S virtual machine, emphasizing its unique approach to object persistence and deployment. The talk begins with a brief introduction to Ruby's history, including its creation by Yukihiro Matsumoto and the pivotal role of David Heinemeier Hansson in popularizing Ruby through Ruby on Rails. Johnny explains that while traditional applications have distinct separations between data and code, MagLev's transient and committed objects allow for a different approach where live objects are preserved across sessions.

Key points covered in the talk include:

  • History of Ruby: Ruby was developed in 1996, aimed at being a fun and enjoyable scripting language, with significant contributions from its creator, Matz.
  • The Significance of GemStone: GemStone S, established in 1986, enhances Ruby by providing a robust VM capable of managing large datasets, which is integral to MagLev's performance.
  • MagLev Operations: The installation of MagLev involves downloading the GemStone and Ruby core, allowing them to work together seamlessly. This setup draws parallels to traditional data store installations like PostgreSQL.
  • Object Persistence: The presentation illustrates how persistent changes in MagLev require specific blocks to commit data, contrasting this with traditional transient states where data is lost once the process ends.
  • Demonstrations: Johnny presents practical examples of MagLev, such as creating a persistable 'hat' object and implementing a job queue system that allows for persistent execution of code blocks, thus demonstrating MagLev's capabilities in managing persistent data effectively.
  • Advanced Applications: The speaker also delves into geo-hashing as a method for efficient geographic data encoding, further showcasing MagLev’s performance in handling location-based data tasks.

The conclusion of the presentation underscores the innovative aspects of MagLev, particularly how it changes the paradigm of data and code integration in Ruby development. Johnny expresses gratitude for the audience's involvement and hints at future discussions on these technologies.

MagLev - From Download to Deploy
Johnny T • March 17, 2014 • Earth

MagLev is a Ruby implementation built on top of a mature VM which offers native object persistence. Working with these live objects is awesome - but this image-based development is very different than traditional file-based development. MagLev uses both which has broad reaching effects - from design to deployment.
In traditional applications, data and code are separate. Deployments involve pulling new code, updating or migrating the data-store, and restarting or reloading the application which creates a new runtime with this new code.
MagLev's transient objects behave in this same manner, but committed objects are always there. Migrating these live, persistent objects is quite different. Your 'data' migrations involve things like instance variables, method definitions and class hierarchies, rather than creating tables or updating column definitions.
In this talk we will walk through a number of examples including a simple job and worker which use persisted blocks, and how to deploy an application and migrate persisted objects.

Help us caption & translate this video!

http://amara.org/v/FG2K/

MountainWest RubyConf 2014

00:00:25.519 Hello everyone, I'm Johnny T. Today, we're going to chat about MagLev.
00:00:31.519 I love all of the small talk that we've been hearing.
00:00:36.640 So, raise your hands if you were just introduced to Smalltalk. We've seen quite a few hands go up, so I'm guessing many of you are having similar thoughts going through your minds. It's a lot to take in.
00:00:48.559 It's a very different paradigm. Some aspects are easier, while others can be harder for us as developers to pick up.
00:01:06.799 My job here is mostly done, as Noel just preached the good word of Smalltalk, and many here received it well. Thank you, Noel, for that amazing introduction.
00:01:28.000 To introduce myself, I'm Johnny T, and I work locally for Rakuten Marketing. I started there about six months ago and absolutely love it. We're doing a lot of Ruby work, and we've also begun converting some of our core functionality into Go and doing various projects with JavaScript.
00:01:41.040 We're hiring, and as one of the sponsors here, I have some free items to give out. So that's a little about me and where I work locally.
00:01:52.320 Now, let's start discussing what MagLev is. It is a Ruby implementation that runs on top of the GemStone S VM.
00:02:10.800 To understand that, let's dive into the history of Ruby. Ruby was created in 1996 by Yukihiro Matsumoto, also known as 'Matz.' He is a lover of programming languages.
00:02:27.440 Matz's primary goal in creating Ruby was to develop a scripting language that was enjoyable and fun to use, and it truly succeeded at that. I discovered Ruby about eight years ago, and it brought happiness into my life as a developer.
00:02:46.160 If Matz ever sees this, I want to thank him publicly. Let's all give him a big round of applause for his incredible contribution to our community.
00:03:05.680 When Matz was about to create Ruby, he was exploring various programming languages. Let’s jump back in time to 1978, before Ruby was born. An article in Byte magazine featured a sketch that illustrates the landscape of programming languages at that time.
00:03:42.080 The sketch depicted languages like Fortran on the ocean, where various boats were trying to navigate through some challenging waters, and Lisp was visualized as a jungle shrouded in fog, hidden from the seafarers.
00:04:06.959 At this time, Smalltalk was also in the mix. By 1981, another article emerged in Byte magazine discussing the design principles behind Smalltalk. Dan Ingalls wrote about how, to be truly object-oriented, a system must provide automatic storage management.
00:04:28.320 This concept is one of the hardest things for developers to truly grasp and apply in Smalltalk. It highlights a fundamental difference in how we think about programming and managing data.
00:05:05.640 I also have some memorabilia from that time, including signed copies of the magazine and other works by Dan Ingalls. Allen Kay, the creator of Smalltalk, envisioned a portable computer that would one day be in every child's hands.
00:05:44.320 This vision has largely come true, with technology becoming more accessible to children. I had the pleasure of meeting Allen Kay at a keynote at the University of Utah a couple of years ago, which was an incredible experience.
00:06:12.560 Now, let’s get back to MagLev. I want to explain a basic Ruby process. If you're running a command line, you can use the '-e' flag to evaluate a string with Ruby.
00:06:34.240 When using MRI, you run Ruby, which fires up the MRI interpreter. This interpreter loads Ruby core, which is compiled C code. It processes the string provided and outputs results consistent with Ruby’s expected behavior.
00:07:11.920 Around 2003, seven years after Ruby's birth, we still needed to spread the word about it. That's when David Heinemeier Hansson (DHH) came onto the scene, creating Ruby on Rails and boosting Ruby's visibility significantly.
00:07:54.240 Fast forward 12 years, and Charles Nutter emerges from Java's realm with JRuby, another significant evolution in Ruby’s history. Java and Ruby were born in the same year, 1996, and since then, many enhancements have been made to both ecosystems.
00:08:15.840 Java benefits from having strong backing from large corporations that invested heavily in the JVM, leading to a wealth of advanced features. One of those features is threading, where Java threads can efficiently utilize multi-core machines.
00:08:55.840 To give you an idea of how the Java process runs, you can use RVM to switch to JRuby, which then runs a command that invokes Java, subsequently loading Ruby core from a jar file.
00:09:27.200 In 2008, another important figure entered the scene: Avi Bryant. He recognized similarities between Ruby's object model and Smalltalk's, which led him to GemStone, a company that could potentially help Ruby run on top of their VM.
00:10:06.560 GemStone S was launched in 1986. During the decade before Ruby was born, the team worked with significant clients like Oocl and JP Morgan, who utilized the GemStone for managing massive datasets.
00:10:52.080 After working with these clients, a multitude of enhancements were made to GemStone, ensuring it could effectively manage large data volumes and rapidly operate on them, paving the way for applications running on MagLev.
00:11:36.720 When performing an installation of MagLev using RVM, a few important actions occur. First, the GemStone, or stone, is downloaded to your machine. This stone features objects that may be decades old, with contributions from some of the original authors of Smalltalk.
00:12:10.760 Once the stone is downloaded, the next step involves loading Ruby core into it, allowing for a functional MagLev setup where both Ruby code and GemStone interact effectively.
00:12:56.959 With traditional data stores like PostgreSQL, you need to install the system, set up credentials, and start a daemon. This process is somewhat similar in MagLev since it combines traditional Ruby operations with the functionality of a stone that stores data.
00:13:37.680 When you start a MagLev process, the stone must be running first. Like PostgreSQL, logging into the stone allows operations to access shared memory settings that have been optimized for performance.
00:14:04.080 As a client logs into the stone, it directly connects to all content stored within it without needing additional data loading, thanks to shared memory management improvements.
00:14:39.760 The operation of the Ruby engine in MagLev, much like what happens with Java systems, is that it initializes a command, logs in, and allows users to execute Ruby code seamlessly.
00:15:24.480 We can consider three significant Ruby implementations: MRI, JRuby, and MagLev. Each implementation serves different needs and fits various paradigms, providing developers with several avenues for work.
00:15:51.760 A well-known issue in programming is the object-relational impedance mismatch. For many developers, transitioning from relational databases to Ruby's object-oriented nature can be challenging because we often continue to think in terms of traditional data structures.
00:16:30.000 Now, I want to walk through some examples using MagLev to illustrate its capabilities. We'll start with a demonstration that Avi Bryant presented at Railsconf back in 2008, showcasing a simple 'hat trick' with blocks in MagLev.
00:17:08.640 In this first example, we’re going to create a class for a hat. This will include some contents, represented here by a simple ASCII rabbit. One important note here is that everything you code inside MagLev operates within a transaction.
00:17:47.520 When intending to alter persistent data, you need to use a specific block for the operations. By default, any changes you perform in a transient space will be lost once the process concludes.
00:18:25.760 To persist any changes in MagLev, you can utilize a persistent hash that facilitates committing data into the stone. This approach resembles garbage collection processes for variables.
00:19:09.600 Now, let’s see a demonstration, where we have two terminal windows: one displays the MagLev stone, while the other uses 'mag remote' to interact from another machine.
00:19:49.760 When the stone starts, it initializes several processes. Starting with a clean slate, we fire up the stone alongside the shared page cache, allowing seamless communication across nodes.
00:20:27.440 In the following steps, we create and commit a 'hat' object. The process allows us to investigate the contents of the shared result from other remote terminals while noting any differences in processing speed.
00:21:15.599 This demonstration highlights MagLev's ability to maintain shared memory effectively, ensuring that once an object is loaded, subsequent executions draw data from a cache for improved performance.
00:21:45.360 Next, I want to cover a basic job queue implementation that showcases how you can persist blocks of code and call them later across different remote machines.
00:22:20.880 By creating a basic job class that stores and appends blocks to a queue, you can persist these jobs across the system and call them as needed. This allows for functions that can operate independently of each other.
00:22:59.199 In a final demonstration, I'll show you how geo-hashing can efficiently encode geographical coordinates into a singular character string. This has applications in rapidly accessing location-related data.
00:23:30.960 This process divides the globe into multiple tiles, leading to fast and efficient access to large datasets with minimal processing time.
00:24:10.160 By creating a simple geocoding mechanism, you can access stored data and perform quick operations using geohashes. I provide you with access to my shared repository for further examination.
00:25:00.400 Before wrapping up, I just want to say a big thank you for attending today. These discussions and explorations into the world of MagLev have been exciting, and I hope you found them informative.
00:25:45.360 I'm Johnny T, and I look forward to future conversations about these topics. Thank you for your time.
00:26:05.200 I'll just leave you with this – it's a little something shared by a colleague at MoneyDesktop that I hope brings a smile to your face.
Explore all talks recorded at MountainWest RubyConf 2014
+12