- Update your VirtualBox
- Download ubuntu LTS server (64 bit)
- name “garmz-dev”
- Run default installation from the downloaded iso in new VM
- hostname “garmz-dev”
- Don’t encrypt home
- No automatic updates
- Pick OpenSSH server and PostgreSQL server
require 'chronic' | |
class PassengerProcess | |
attr_accessor :pid, :uptime | |
def initialize(passenger_status_line) | |
values = passenger_status_line.match(/PID:\s(\d*).*Uptime:\s*(.*)$/) | |
@pid = values[1].to_i | |
@uptime = values[2] | |
end |
$ ruby benchmarks/excon_vs_google.rb | |
[em-http-request, HTTParty, Net::HTTP, Net::HTTP (persistent), open-uri, RestClient, StreamlyFFI (persistent), Typhoeus, Excon, Excon (persistent)] | |
+--------------------------+-----------+ | |
| tach | total | | |
+--------------------------+-----------+ | |
| Excon | 7.614298 | | |
+--------------------------+-----------+ | |
| Typhoeus | 7.723362 | |
This was going to go into a blog post, but was removed after discussion around it being a Bad Thing for customers to do.
To stop applications that are prone to bloating quickly exhausting all the memory on an application instance, we have a script called passenger_monitor that checks for runaway Passenger processes every minute via a cron job. By default, this script is going to look for Passenger workers that are using over 215MB of memory and kill them. Passenger will restart them when needed. We tune the number of workers that run by default on your application instances, based on the memory specifications so that the memory is sensibly utilized. However, if your application legitimately requires more memory than this (i.e. it isn’t bloating) then it may be advantageous for you to reduce the worker count, and allow the lower number of workers to use more memory.
Doing this involves two areas of customization; modifying the Nginx configuratio
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/ | |
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration | |
article’s settings: ("spec spec" took 17-23!sec) | |
export RUBY_HEAP_MIN_SLOTS=1250000 | |
export RUBY_HEAP_SLOTS_INCREMENT=100000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=30000000 | |
export RUBY_HEAP_FREE_MIN=12500 |
#!/usr/bin/env ruby | |
require 'socket' | |
test_file = ARGV[0] | |
socket = UNIXSocket.new('testing.sock') | |
socket.write(test_file) | |
socket.close_write |
defmodule HttpRequester do | |
use GenServer | |
def start_link(_) do | |
GenServer.start_link(__MODULE__, nil, []) | |
end | |
def fetch(server, url) do | |
# Don't use cast: http://blog.elixirsips.com/2014/07/16/errata-dont-use-cast-in-a-poolboy-transaction/ | |
timeout_ms = 10_000 |