|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Rubinius 2.0 Released |
| 4 | +author: Brian Shirai |
| 5 | +--- |
| 6 | + |
| 7 | +We are thrilled to announce the release of Rubinius 2.0. There are many |
| 8 | +exciting things to share. We'll review what Rubinius is, look at what you can |
| 9 | +expect from this release and future releases, and talk about plans for the |
| 10 | +future. |
| 11 | + |
| 12 | +## Many Thanks! |
| 13 | + |
| 14 | +Rubinius 2.0 would not be possible without the tremendous support and |
| 15 | +contributions from so many amazing people. |
| 16 | + |
| 17 | +Thanks Matz for creating Ruby. Thanks David Heinemeier Hansson for creating |
| 18 | +Ruby on Rails, which spread Ruby happiness around the world. Thanks Evan |
| 19 | +Phoenix for creating Rubinius and inspiring us to think beyond current |
| 20 | +limitations. |
| 21 | + |
| 22 | +Thanks to the hundreds of contributors for their time, efforts, and frustration |
| 23 | +while improving Rubinius and RubySpec. There isn't room to list them all, but |
| 24 | +their indelible mark on Rubinius lives on in the source code. |
| 25 | + |
| 26 | +Thanks to the Ruby developers, students, and businesses that all contribute to |
| 27 | +making Ruby better. Thanks to Engine Yard for financially supporting Rubinius |
| 28 | +development and sponsoring all those rad tshirts and stickers people loved so |
| 29 | +much. |
| 30 | + |
| 31 | +All of these people and organizations, not just Ruby developers, are _the Ruby |
| 32 | +community_. Rubinius owes you a huge debt of gratitude. |
| 33 | + |
| 34 | +## The 2.0 Story |
| 35 | + |
| 36 | +With the 2.0 release, Rubinius regains a laser focus on supporting the future |
| 37 | +of Ruby. Rubinius 2.0 is expected to be compatible with Ruby 2.1. |
| 38 | + |
| 39 | +While MRI hasn't released 2.1 yet, Rubinius will continue improving |
| 40 | +compatibility as more features are finalized. Last RubyConf, Matz urged people |
| 41 | +to upgrade as soon as possible to Ruby 2.0. Significant effort has been |
| 42 | +dedicated to making the upgrade from 1.9 as simple as possible. Rubinius |
| 43 | +supports the effort to move Ruby into the future. |
| 44 | + |
| 45 | +Rubinius started life with the goal of bringing modern technology to Ruby's |
| 46 | +implementation, giving developers more power, and businesses who rely on Ruby a |
| 47 | +faster, more stable and more efficient platform on which to build products and |
| 48 | +services. |
| 49 | + |
| 50 | +Over time, we've tried to support multiple Ruby language versions, many |
| 51 | +different projects, old and new code, code that abuses every corner of MRI's |
| 52 | +*ad hoc* semantics, and every random, undocumented MRI C function with the |
| 53 | +Rubinius C-API compatibility layer. Unfortunately, this is unsustainable and |
| 54 | +not in the best interests of Ruby or Rubinius. |
| 55 | + |
| 56 | +Starting with 2.0, Rubinius will concentrate on providing exceptional Ruby |
| 57 | +support for building modern concurrent and distributed applications. Not every |
| 58 | +legacy Ruby program or quirky Ruby feature will be suitable for Rubinius. |
| 59 | +Instead, we'll prioritize the performance and stability of concurrent |
| 60 | +applications to make Ruby competitive with Go, Erlang, Clojure, Scala, and |
| 61 | +Node. |
| 62 | + |
| 63 | +## Versions and Releases |
| 64 | + |
| 65 | +Starting with Rubinius 2.0, we're changing the way releases are done. |
| 66 | + |
| 67 | +Every week or so, we'll release a version of Rubinius. We are not following a |
| 68 | +pre-determined release schedule. We will continue to keep the master branch |
| 69 | +extremely stable, as we have done for years. If there are only bug fixes on |
| 70 | +master since the last *X.Y.Z* release, the new version will be *X.Y.Z+1*. If |
| 71 | +there are other changes, the new version will be *X.Y+1.0*. |
| 72 | + |
| 73 | +We're moving to this release process to get updates into your hands as quickly |
| 74 | +as possible. No matter how much work we do, there is always more. A release |
| 75 | +never seems _ready_. Releases are painful to get right. So we are following the |
| 76 | +advice, "If something is painful, push it to the front and work to reduce the |
| 77 | +pain." There will be bugs with our Ruby 2.1 compatibility. If something is |
| 78 | +broken for you, please file an issue. Hopefully it will be fixed and released |
| 79 | +within days. |
| 80 | + |
| 81 | +The goal is to [semantically version](http://semver.org) the Rubinius core |
| 82 | +starting with version 3.0. During the 2.x to 3.0 transition, we'll be very |
| 83 | +careful about introducing breaking changes, but we'll do so when the benefits |
| 84 | +outweigh the risks. Obviously, the more we know about how Rubinius is being |
| 85 | +used, the better we can evaluate these decisions. |
| 86 | + |
| 87 | +We've added a subdomain [http://releases.rubini.us](http://releases.rubini.us) |
| 88 | +for hosting release tarballs. We expect that over the next few days the many |
| 89 | +Ruby installers and switchers will be updated to install Rubinius. |
| 90 | + |
| 91 | +Below, in the section on future plans, I'll explain what we hope to accomplish |
| 92 | +with these ambitious release plans. |
| 93 | + |
| 94 | +## Rubinius Parts |
| 95 | + |
| 96 | +Many people have heard that Rubinius is an implementation of the Ruby |
| 97 | +programming language. There's a lot wrapped up in that simple description. |
| 98 | +Let's review the major pieces of technology in Rubinius today. Later, we will |
| 99 | +look at plans to improve these in the future. |
| 100 | + |
| 101 | +The Rubinius architecture is fairly standard for a modern language runtime. |
| 102 | + |
| 103 | +The bytecode virtual machine (VM) runs the bytecode produced by the Ruby |
| 104 | +compiler. A notable feature is that every Ruby method essentially gets its own |
| 105 | +interpreter. This enables powerful features like the full-speed built-in |
| 106 | +debugger. Only the specific Ruby method with debugger breakpoints runs the |
| 107 | +"debug" interpreter while the rest of the methods run at normal speed. |
| 108 | + |
| 109 | +The generational garbage collector (GC) has a very fast young generation |
| 110 | +collector, usually pausing for less than 15 ms to complete a collection. |
| 111 | +Applications running on Rubinius typically see shorter GC pauses times and many |
| 112 | +fewer noticeable GC pauses because the entire heap needs to be collected far |
| 113 | +less often. Rubinius also has a partially concurrent mark phase for the mature |
| 114 | +generation which further reduces the GC pause times when a full collection is |
| 115 | +required. |
| 116 | + |
| 117 | +Rubinius implements native operating system threads for concurrency and has no |
| 118 | +global interpreter lock (GIL). Ruby code can run in parallel on multi-core or |
| 119 | +multi-CPU hardware. |
| 120 | + |
| 121 | +The Rubinius just-in-time compiler (JIT) turns Ruby bytecode into machine code. |
| 122 | +The JIT thread is mostly independent of the Ruby threads so the JIT operation |
| 123 | +doesn't impact the running code's performance. The JIT framework tracks which |
| 124 | +methods are often used and what types of objects are seen. Using this runtime |
| 125 | +data, the JIT is able to combine application methods and core library methods, |
| 126 | +generating highly optimized machine code that runs several times faster than |
| 127 | +the bytecode interpreter. |
| 128 | + |
| 129 | +The Rubinius core libraries (e.g. Array, Hash, Range, etc.), as well as |
| 130 | +Rubinius tools like the bytecode compiler, are written in Ruby. The Rubinius |
| 131 | +systems treat them just like Ruby application code (e.g. the JIT combining core |
| 132 | +library methods and application methods to best optimize running code). This |
| 133 | +consistency also improves understanding of the entire Rubinius system. Ruby |
| 134 | +developers can contribute to significant parts of Rubinius by simply by writing |
| 135 | +Ruby code. |
| 136 | + |
| 137 | +## Plans, Meet Future |
| 138 | + |
| 139 | +For Rubinius to have a place in future application development, it must serve |
| 140 | +the needs of those applications. |
| 141 | + |
| 142 | +The world is rapidly changing and the rate of change is accelerating. Building |
| 143 | +software today is different than it was just five years ago. Continuous |
| 144 | +delivery and A/B testing are becoming commonplace. Businesses must experiment |
| 145 | +to discover how to compete in changing conditions. Driving down the cost of |
| 146 | +experimenting is essential. |
| 147 | + |
| 148 | +More now than ever, time is money. The time scale to deliver features must be |
| 149 | +hours or days, not weeks or months. To meet the required velocity, building |
| 150 | +concurrent and distributed applications in a heterogenous environment is no |
| 151 | +longer optional, it is essential. |
| 152 | + |
| 153 | +Ruby is more suited than many languages to rapidly deliver features, reducing |
| 154 | +the cost to experiment and the time needed to begin engaging customers. |
| 155 | +Unfortunately, Ruby development has not kept pace with the software as a |
| 156 | +service revolution. |
| 157 | + |
| 158 | +Ruby became popular because Ruby on Rails accelerated the delivery of value by |
| 159 | +an order of magnitude. This influence is rapidly declining. Efficiencies that |
| 160 | +Rails introduced, things like _convention over configuration_ and full-stack |
| 161 | +integration, also encouraged monolithic application architectures. Applications |
| 162 | +built this way are difficult to change and difficult to scale, which means that |
| 163 | +under changing conditions, their costs tend to quickly outweigh any value they |
| 164 | +deliver. Businesses are rapidly learning this lesson. |
| 165 | + |
| 166 | +## Future, Meet Plans |
| 167 | + |
| 168 | +Roadmaps are notoriously painful because, oddly enough, predicting the future |
| 169 | +continues to be an inexact science. Given the future that Rubinius wants to |
| 170 | +support—concurrent and distributed applications—the following are |
| 171 | +specific areas we plan to improve in the coming weeks. |
| 172 | + |
| 173 | +1. Rubinius has no global interpreter lock, but we can significantly improve |
| 174 | +concurrency coordination in the system. During some phases of garbage |
| 175 | +collection, some operations of the JIT, and during fork/exec, we have to stop |
| 176 | +all the threads. We intend to improve this significantly so that less |
| 177 | +coordination is required. |
| 178 | +1. In place of the GIL, Rubinius uses finer-grained locks internally in various |
| 179 | +places. These can be reduced further, improving multi-core efficiency, by using |
| 180 | +modern lock-free concurrent data structures. |
| 181 | +1. While the garbage collector has reasonably low pauses, we can improve this |
| 182 | +by making the GC more concurrent and parallel. |
| 183 | +1. The JIT compiler already often improves Ruby code performance by 2-4x over |
| 184 | +executing bytecode. We can do even better. We will improve communicating Ruby |
| 185 | +semantics to the JIT to avoid unnecessarily allocating objects and doing |
| 186 | +unnecessary bookkeeping that slows performance. We will expose more of the JIT |
| 187 | +framework to Ruby to enable rapidly coding and testing new ideas for optimizing |
| 188 | +Ruby. |
| 189 | + |
| 190 | +## Gems as Components |
| 191 | + |
| 192 | +The ability to compose independent components is one of the best means to |
| 193 | +manage high complexity. In Ruby, the natural way to package, distribute, and |
| 194 | +compose components is gems. |
| 195 | + |
| 196 | +Rubinius wants to bring the advantages of continuous delivery and the |
| 197 | +"evergreen browser" idea to Ruby developers. The Rubinius approach to this is |
| 198 | +to fully leverage gems. |
| 199 | + |
| 200 | +Rubinius itself has been dramatically simplified. Major components, like the |
| 201 | +bytecode compiler, Ruby parser, debugger, etc. have been moved to gems. These |
| 202 | +components can be updated easily and quickly without requiring a Rubinius |
| 203 | +release. These components participate in the Ruby ecosystem, for example |
| 204 | +[Bundler](http://bundler.io) or [dep](https://github.com/cyx/dep), like all the |
| 205 | +gems that Ruby developers are familiar with. |
| 206 | + |
| 207 | +In Rubinius 2.0, the [Ruby standard library](http://rubysl.github.io) has also |
| 208 | +been converted to gems. The Ruby standard library is some of the oldest Ruby |
| 209 | +code that exists. Due to being bundled with MRI all these years, it was far |
| 210 | +more difficult to change than a library or gem. Every change required MRI to |
| 211 | +accept it, and any changes required waiting for a new release of MRI, something |
| 212 | +which did not happen frequently. |
| 213 | + |
| 214 | +It's not surprising that many people simply went around these obstacles and |
| 215 | +made alternate libraries. Instead of being the pinnacle of excellent Ruby |
| 216 | +design and idioms, parts of the standard library bit-rotted and retained |
| 217 | +anachronisms like embedded tests at the end of files. Further, many of the |
| 218 | +critical libraries were written as C extensions, making them unusable by JRuby, |
| 219 | +Topaz, IronRuby, Opal, and early MagLev (which now has some C-API support). |
| 220 | + |
| 221 | +In Rubinius 2.0, the components and standard library are _just gems_. There is |
| 222 | +nothing special about them. They are installed as gems. They participate in gem |
| 223 | +sets and Bundler workflow as gems. There are some challenges required to |
| 224 | +bootstrap the gems, but that requires an internal Rubinius command, not changes |
| 225 | +to the RubyGems infrastructure. |
| 226 | + |
| 227 | +Providing the standard library as gems opens the opportunity to rebuild it _in |
| 228 | +Ruby_ and improve the code rapidly so that multiple implementations can share |
| 229 | +it. However, we are also not bound to using any of these libraries. Since they |
| 230 | +are just gems, they can be put in a Gemfile, _or not_, if there are better |
| 231 | +libraries available. There's no point spending time "improving" things that no |
| 232 | +one wants. Supporting newer libraries with better code and APIs may be much |
| 233 | +more beneficial. This is now an option. |
| 234 | + |
| 235 | +We'll be monitoring what people do and where pain points are. Building on all |
| 236 | +the gem infrastructure, we open up a world of possibilities for Ruby |
| 237 | +developers. |
| 238 | + |
| 239 | +## Rubinius Inspirations |
| 240 | + |
| 241 | +As 2.0 is a big milestone and transition, it's interesting to reflect on some |
| 242 | +significant Rubinius contributions to the Ruby community. |
| 243 | + |
| 244 | +Rubinius has inspired a number of projects that have benefited Ruby far beyond |
| 245 | +Rubinius. The best known of these is [**RubySpec**](http://rubyspec.org), which |
| 246 | +is used by every significant Ruby implementation, including promising new ones |
| 247 | +pushing the limits, like [Topaz](http://www.topazruby.com) and |
| 248 | +[Opal](http://opalrb.org). |
| 249 | + |
| 250 | +Rubinius also created the initial **FFI** spec that opened the world of native |
| 251 | +libraries to Ruby with a simple API across implementations and without needing |
| 252 | +to write C-extenions. |
| 253 | + |
| 254 | +Evan created [**Puma**](http://puma.io) to meet the need for a fast web server |
| 255 | +that would promote the Rubinius parallel thread support. Puma also works well |
| 256 | +on MRI and JRuby. It provides Ruby applications excellent performance and |
| 257 | +multi-core scaling, especially when there's no global interpreter lock. |
| 258 | + |
| 259 | +Rubinius as a language platform has inspired many |
| 260 | +[**projects**](http://rubini.us/proceecs) and encouraged people who may have |
| 261 | +thought language design was beyond their skills to experiment and discover the |
| 262 | +tremendous joy in creating [**their own programming |
| 263 | +language**](https://github.com/queenfrankie/lani). |
| 264 | + |
| 265 | +It is a joy that Rubinius has been a part of these efforts and we will continue |
| 266 | +improving developer experience in these areas. |
| 267 | + |
| 268 | +## Ready, Set, Ruby! |
| 269 | + |
| 270 | +Concurrent and distributed applications aren't the future anymore, they are the |
| 271 | +present. They are vital to business success. The many talented developers that |
| 272 | +are passing over Ruby for Erlang, Go, Clojure and Node are draining Ruby of |
| 273 | +talent and vitality. |
| 274 | + |
| 275 | +Ruby is an excellent language. Rubinius is dedicated to providing Ruby |
| 276 | +developers with excellent tools and technology competitive with these other |
| 277 | +languages. Developers who are happy writing Ruby shouldn't be forced to leave |
| 278 | +it because of technical limitations. |
| 279 | + |
| 280 | +If you are one of these developers, let's build the future. |
0 commit comments