You can now find this packaged up nicely in a rubygem as rollout-zk.
I've implemented a zookeeper-based storage adapter for [rollout][] that does not require any network roundtrips to check if a feature is active for a user.
You can now find this packaged up nicely in a rubygem as rollout-zk.
I've implemented a zookeeper-based storage adapter for [rollout][] that does not require any network roundtrips to check if a feature is active for a user.
Heroku uses buildpacks to compile your application into a slug that is used across dynos for scaling horizontally quickly. A slug is a tar.gz archive of your app’s repository with certain pre-deploy features baked into the filesystem. Since everything to run your application is included in the archive, scaling becomes a simple matter of transferring it to a dyno, unpacking, and running the appropriate process. This is how Heroku achieves scaling-by-moving-a-slider.
For example, the Ruby buildpack will:
if (-f $document_root/system/maintenance.html) { | |
return 503; | |
} | |
error_page 503 @maintenance; | |
location @maintenance { | |
internal; | |
if ($http_accept ~ json) { | |
return 503 "{}"; | |
} |
max_stack_frames = 500 | |
TooManyStackFrames = Class.new(StandardError) | |
set_trace_func proc { |event, file, line, id, binding, classname| | |
if event == "call" && caller.size >= max_stack_frames | |
raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames" | |
end | |
} |
$ = jQuery | |
$.fn.extend | |
foobar: (method) -> | |
settings = | |
option1: true | |
option2: false | |
#Overview drip is an awesome command line tool that can be used to dramatically lower perceived JVM startup time. It does this by preloading an entirely new JVM process\instance and allowing you to simply use the preloaded environment. This has extraordinary results with jruby.
We reduced time to run rake environment
from 13 seconds to a mere 3.5 seconds. This is actually at or near MRI 1.9.3p327 (with falcon patch) speeds!
Adding a few addition jruby options will reduce startup time even further (down to 1.69 seconds).
#Install Drip Install drip if you haven't already (see https://github.com/flatland/drip)
#!/bin/bash | |
set -ve | |
lxc-create -n vpn -t ubuntu | |
# ln -s /var/lib/lxc/vpn/config /etc/lxc/auto/vpn.conf | |
perl -i -ple 's/#lxc.aa_profile = unconfined/lxc.aa_profile = unconfined/' /etc/lxc/auto/vpn.conf | |
perl -i -ple 's/^exit 0/# exit 0/' /etc/rc.local | |
cat >>/etc/rc.local <<hello | |
mkdir -p /var/lib/lxc/vpn/rootfs/dev/net/ |
class Safeware | |
def initialize(app) | |
@app = app | |
end | |
# This dup pattern is used frequently to avoid race conditions on state stored | |
# inside this middleware. It's not foolproof, but if you're just using | |
# single-reference instance variables (instance variables with primitive | |
# values (not data structures)) then it works well. |
This configuration works with Upstart on Ubuntu 12.04 LTS
The reason why it needs to be done this way (i.e. with the pre-start
and post-stop
stanzas), is because Upstart
is unable to track whever Unicorn master process re-execs itself on hot deploys. One can use it without hot-deploys
and run Unicorn in foreground also, it then only needs one exec stanza.
This presumes you are not using RVM, so no voodoo dances.