Skip to content

Instantly share code, notes, and snippets.

@the8472
the8472 / minimal testing up
Created December 12, 2012 16:28
Rails startup performance tuning with jruby. Note that those settings are *not* for optimal steady state operation.
### ruby 1.9.3 + railsexpress patches + GC tuning + -march=native -O3
time ruby script/rails r 'Post.count'
real 0m1.008s
user 0m0.820s
sys 0m0.180s
### jruby 1.7.2-dev 2012-12-12 + java 64bit 1.8.0-ea-b67 hotspot 25.0-b11
@pmahoney
pmahoney / bundle_exec.sh
Created September 5, 2012 21:20
Like bundle exec, but exec's in shell to avoid child process in JRuby 1.6
#!/bin/sh
#
# bundle_exec.sh - emulate 'bundle exec' but with a shell script
# rather than a ruby script. Modifies the environment just like
# bundle exec would.
#
# Running "bundle exec ruby" starts a ruby in which then execs the
# command, 'ruby'. In JRuby 1.6, the command is started in a child
# process. When using a Foreman-like tool that has the ability to
# kill and/or restart such a command, only the parent will be killed
module God
module Conditions
class RestartFileTouched < PollCondition
attr_accessor :restart_file
def initialize
super
end
def process_start_time
Time.parse(`ps -o lstart -p #{self.watch.pid} --no-heading`)