Deploying with JRuby: Deliver Scalable Web Apps using the JVM (Pragmatic Programmers)
Deploy utilizing the JVM's excessive functionality whereas construction your apps within the language you like. JRuby is a quick, scalable, and robust JVM language with all of the advantages of a standard Ruby atmosphere. See the best way to consolidate the various relocating components of an MRI-based Ruby deployment onto a unmarried JVM technique. you will how one can port a Rails program to JRuby, get it into creation, and continue it running.
JRuby deployments have fewer relocating elements and eat much less reminiscence than conventional Ruby deployments, yet to installation your apps at the JVM, you want to examine a few new ways. This e-book introduces you to 3 JRuby deployment innovations that may provide the functionality and scalability you would like whereas letting you utilize the language you love.
you are going to commence by way of porting an latest program to JRuby, getting ready the app to use the JVM platform. Then you are going to use Vagrant and Puppet to construct a digital construction surroundings so that you have a good, reproducible position to discover JRuby deployment.
along with your setting in position, you will test with uncomplicated JRuby deployment with Warbler as you package deal your Ruby net software right into a unmarried dossier you could installation to a Java software server. subsequent you will arrange the light-weight Trinidad internet server to create a extra versatile, modular deployment that matches extra complicated events yet nonetheless feels pleasant and standard to Ruby builders. you are going to change to powering your app with TorqueBox, an all-in-one JRuby surroundings that comes with integrated help for messaging, scheduling, and daemons--perfect for dealing with the "big jobs." Then, you will organize a continual integration atmosphere with Jenkins so that you can install just like the pros.
Deploying with JRuby is the lacking hyperlink among having fun with JRuby and utilizing it within the actual global to construct high-performance, scalable applications.
What You Need:
To run the examples during this publication, you will need a working laptop or computer which could run the Java digital Machine.
program isn't thread-safe, however it seriously limits the concurrency of our net server. It additionally calls for extra reminiscence. we will configure the dimensions of the runtime pool within the config/warble.rb dossier. expanding the utmost variety of runtime situations increases the concurrency of our net server. lowering the minimal variety of cases will increase our server’s start-up time. The variety of runtimes you can use is dependent upon your server undefined. every one extra runtime would require one other.
Any software is thread-safe. yet we’ve taken a glance at Twitalytics’ code, so now we have self belief that it’s right. Now we have to configure Rails to run in thread-safe mode by way of uncommenting the next line in our config/environments/production.rb dossier: Warbler/twitalytics/config/environments/production.rb config.threadsafe! Warbler is Rails-aware, so it is going to notice this configuration and implicitly create a unmarried runtime example of our software. simply because a improvement server has in simple terms.
working method is prepared! Now we have to set up a few software program on it. 2.2 Provisioning with Puppet Puppet is a configuration administration instrument for Linux and Unix platforms that automates the stairs for development any type of server surroundings. We’ll be utilizing it to provision our digital computing device with the infrastructure essential to run a JRuby program, yet it’s in a position to even more. in truth, Puppet is able to automating approximately each point of a process administrator’s task together with handling consumer.
consultation info in an example of ActiveRecord::SessionStore, which persists person periods to the database. yet placing clients’ periods within the database is mostly now not an optimum answer. as well as being gradual, there's an impedance mismatch among the transience of a user’s consultation and the patience of a database. That’s why TorqueBox offers a clusterable consultation shop that does require a database. in its place, it makes use of the Infinispan7 information grid, which deals a noSQL key-value shop that may.
choice to upload. environment the Execution Mode such a lot JVM implementations can run in execution modes, that are configured at start-up time through atmosphere both the --client or --server flag to permit customer and server execution modes, respectively. each one mode determines, between different issues, how the JVM will optimize bytecode at execution. each one mode is defined subsequent: --client In patron mode, a program’s start-up time and reminiscence utilization are minimized. this is often relatively sturdy relating to a neighborhood.