# Fullstaq Ruby Server Edition: a server-optimized Ruby distribution
Fullstaq Ruby is a Ruby distribution that's optimized for use in servers. It is the easiest way to:
* Install Ruby on servers — we supply precompiled binaries.
* Keep Ruby security-patched or up-to-date — integrates with your OS package manager.
* Significantly reduce memory usage of your Ruby apps — a memory reduction of 50% is quite realistic.
* Increase performance — thanks to the usage of better memory allocators.
You can think of Fullstaq Ruby as a competitor of `apt/yum install ruby`, `rbenv install` and `rvm install`. We supply [native OS packages](#how-it-works) for various Ruby versions, which are optionally compiled with [Jemalloc](#what-is-jemalloc-and-how-does-it-benefit-me) or [malloc_trim](#what-is-malloc_trim-and-how-does-it-benefit-me), allowing for lower memory usage and potentially increased performance. Our [packaging method](#minor_version_packages) allows much easier security patching.
> Fullstaq Ruby is a work-in-progress! Features like editions optimized for containers and Heroku, better system integration, and much more, are planned. Please see [our roadmap](https://github.com/fullstaq-labs/fullstaq-ruby-umbrella/projects).
**Table of contents:**
* [Key features](#key-features)
* [Background](#background)
- [Why was Fullstaq Ruby created?](#why-was-fullstaq-ruby-created)
- [Who is behind Fullstaq Ruby?](#who-is-behind-fullstaq-ruby)
* [How it works](#how-it-works)
- [Package organization](#package-organization)
- [Rbenv integration](#rbenv-integration)
- [Minor version packages: a great way to keep Ruby security-patched](#minor-version-packages-a-great-way-to-keep-ruby-security-patched)
- [About variants](#about-variants)
- [Comparisons to other systems](#comparisons-to-other-systems)
+ [Vs RVM and Rbenv](#vs-rvm-and-rbenv)
+ [Vs Ruby packages included in operating systems' official repositories](#vs-ruby-packages-included-in-operating-systems-official-repositories)
+ [Vs the Brightbox PPA](#vs-the-brightbox-ppa)
+ [Vs JRuby, TruffleRuby and Rubinius](#vs-jruby-truffleruby-and-rubinius)
+ [Vs LD_PRELOADing Jemalloc yourself](#vs-ld_preloading-jemalloc-yourself)
* [Installation](#installation)
- [RHEL/CentOS](#rhelcentos)
- [Debian/Ubuntu](#debianubuntu)
- [Deactivate Git-based Rbenv](#deactivate-git-based-rbenv)
- [Activate Rbenv shell integration (optional)](#activate-rbenv-shell-integration-optional)
+ [System-wide shell integration](#system-wide-shell-integration)
* [Usage after installation](#usage-after-installation)
- [Using a specific Ruby version](#using-a-specific-ruby-version)
- [Usage with Rbenv](#usage-with-rbenv)
- [Installing gems and root privileges](#installing-gems-and-root-privileges)
+ [Installing gems system-wide with sudo](#installing-gems-system-wide-with-sudo)
+ [Installing gems without root privileges](#installing-gems-without-root-privileges)
- [Passenger for Nginx/Apache integration](#passenger-for-nginxapache-integration)
- [Puma, Unicorn or Passenger Standalone integration](#puma-unicorn-or-passenger-standalone-integration)
- [Capistrano integration](#capistrano-integration)
* [FAQ](#faq)
- [What is Jemalloc and how does it benefit me?](#what-is-jemalloc-and-how-does-it-benefit-me)
- [What is malloc_trim and how does it benefit me?](#what-is-malloc_trim-and-how-does-it-benefit-me)
- [Is Fullstaq Ruby faster than regular Ruby (MRI)?](#is-fullstaq-ruby-faster-than-regular-ruby-mri)
- [Why does Fullstaq Ruby integrate with Rbenv?](#why-does-fullstaq-ruby-integrate-with-rbenv)
- [I do not need multiple Rubies (and have no need for Rbenv), is Fullstaq Ruby suitable for me?](#i-do-not-need-multiple-rubies-and-have-no-need-for-rbenv-is-fullstaq-ruby-suitable-for-me)
- [Which variant should I pick?](#which-variant-should-i-pick)
- [Why a new distribution? Why not contribute to Ruby core?](#why-a-new-distribution-why-not-contribute-to-ruby-core)
- [Will Fullstaq Ruby become paid in the future?](#will-fullstaq-ruby-become-paid-in-the-future)
- [I am wary of vendor lock-in or that I will become dependent on a specific party for supplying packages. What is Fullstaq Ruby's take on this?](#i-am-wary-of-vendor-lock-in-or-that-i-will-become-dependent-on-a-specific-party-for-supplying-packages-what-is-fullstaq-rubys-take-on-this)
* [Contributing](#contributing)
* [Community — getting help, reporting issues, proposing ideas](#community--getting-help-reporting-issues-proposing-ideas)
---
## Key features
* **Precompiled binaries: save time and energy, increase security**
Stop wasting time and energy with compiling Ruby or applying source patches. We supply precompiled Ruby binaries so that you don't have to. Improve security by eliminating the need to install a compiler on your server.
* **Native OS packages: install and update with tools you already use**
We supply our binaries as [_native OS packages_](#how-it-works) (e.g. via APT, YUM). Easily integrate with your configuration management tools, no need to integrate yet another installer. Easily keep Ruby security-patched or up-to-date with tools you already use.
* **Jemalloc and `malloc_trim` integration: reduce memory usage, increase performance**
> Main articles:
> - [What is Jemalloc and how does it benefit me?](#what-is-jemalloc-and-how-does-it-benefit-me)
> - [What is malloc_trim and how does it benefit me?](#what-is-malloc_trim-and-how-does-it-benefit-me)
> - [Is Fullstaq Ruby faster than regular Ruby (MRI)?](#is-fullstaq-ruby-faster-than-regular-ruby-mri)
In Hongli Lai's research project [What Causes Ruby Memory Bloat?](https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html), Hongli has identified the OS memory allocator as a major cause of memory bloating in Ruby.
There are two good solutions for this problem: either by using [the Jemalloc memory allocator](#what-is-jemalloc-and-how-does-it-benefit-me), or by using [the `malloc_trim` API](#what-is-malloc_trim-and-how-does-it-benefit-me).
Both solutions require patching the Ruby interpreter, but we've done that for you so that you don't have to. Use our binaries, and benefit from reduced memory usage and potentially increased performance out-of-the-box and in a hassle-free manner.
* **Multiple Ruby versions: ensure compatibility**
Not all apps are deployed against the latest Ruby — at least, not all the time. We supply binaries for _multiple Ruby versions_. Enjoy the benefits of Fullstaq Ruby no matter which Ruby version you use.
* **Rbenv integration: manage Ruby versions with already-familiar tools**
Our multi-Ruby support works by integrating with the popular Ruby version manager [Rbenv](https://github.com/rbenv/rbenv). Continue to benefit from Rbenv ecosystem tooling like [capistrano-rbenv](#capistrano-integration). No need to learn another tool for managing Ruby versions.
## Background
### Why was Fullstaq Ruby created?
Fullstaq Ruby came about for two reasons:
* **Optimizing for server use cases.**
Ruby uses a lot of memory. In fact, [way too much and much more than it is "supposed to"](https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html). Fortunately, there are "simple" solutions that provide a lot of benefit to users without requiring difficult code changes in Ruby: by compiling Ruby against the [Jemalloc](http://jemalloc.net/) memory allocator, or by modifying Ruby to make use the `malloc_trim` API. In case you use Jemalloc, you even get a nice performance improvement.
> Main articles:
> - [What is Jemalloc and how does it benefit me?](#what-is-jemalloc-and-how-does-it-benefit-me)
> - [What is malloc_trim and how does it benefit me?](#what-is-malloc_trim-and-how-does-it-benefit-me)
> - [Is Fullstaq Ruby faster than regular Ruby (MRI)?](#is-fullstaq