Joe Ruscio, CTO of Librato, demonstrates Silverline, an app-centric monitoring and workload management service. He shows how Silverline improves capacity planning, continuous deployment, RCA, alerting, and provides predictable degradation under load.
Monthly Archives: March 2011
Standup 03/28/2011: It's over -10,000!
Turns out there’s a hidden “feature” in jQuery’s .animate method. If your starting point for an animation is less than -10,000 px, it sets it to 0. Meaning your -10000 to -12000 animation is going to move a surprising 12000 pixels. There, fixed that for ya!
The -10,000px limit is hard-coded deep in the jQuery animate code, we speculate that it may resolve an issue in one browser or another. So before you start creating Ken Burns-style photo pans with your gigapixel images, make sure you have a plan to dodge this limit.
We’re committed to providing clients with license information for all the libraries we use on each project. To that end, some Pivots have created LicenseFinder, a command line tool which scans your project for Rubygems and summarizes the license data it can recognize. It’s recently had some upgrades. [Check it out].(https://github.com/pivotal/LicenseFinder)
Standup 3.25.2011:
Help
- fonts.com is giving 404s, it appears their CDN is down
- How do you style a File Input? There are several jQuery plugins that do this, one that worked well (and includes drag & drop support) is jQuery-File-Upload
- Selenium + Webrat, oh my: If you try adding selenium tests to an existing test suite you may find that your test database data gets blown away. A good solution to this is to separate your selenium tests into another test suite and run them separately
Interesting
- assert_template is just doing a regex, which means that it may incorrectly be passing if you are asserting on a string that is a substring of the actual template name you expect
Bash Brace Expansion
In our static assets directory, we have the following directories:
public/images public/javascripts public/stylesheets
We want to namespace our application (my_app). We could type the following:
mkdir public/images/my_app mkdir public/javascripts/my_app mkdir public/stylesheets/my_app
Or to save time, we could type:
mkdir public/{images,javascripts,stylesheets}/my_app
This will create the three directories with one command.
For more information on bash curly brace expansion, checkout this article by Mitch Frazier on Linux Journal.
Another expansion I’ve used:
cp file.txt{,.bak}
cp file.txt file.txt.bak
Standup 3/24/2011: Spork and debugging
Helps
“Chrome 11 + Webdriver + Java applets – Chrome 11 has changed the always allow Java plugins setting so that it is no longer global, and must be allowed for each applet. When running tests, Webdriver deletes the profile that stores this setting after each test run, causing specs to fail since a new dialog asking whether to allow the plugin pops up every time. Any ideas?”
The current fix seems to be to downgrade to Chrome 10.
“Does anyone know why using Spork + the ruby debugger just outputs ‘disconnected’ and doesn’t break at any breakpoints?”
The general consensus is to run tests on Spork and print out Spork when you want to debug.
Interesting Things
- You should try Spork if you’re using Rails 3 and your tests are running slowly.
Noop Handler – Catching 80K requests per second without breaking a sweat
Sure it’s a noop test and running on a iMac i7, but 80K requests per second is pretty impressive for 40 lines of code.
package manual;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
public class NoopHandler {
public static void main(String[] args) throws Exception {
QueuedThreadPool pool = new QueuedThreadPool();
pool.setMaxThreads(50);
Server server = new Server();
server.setThreadPool(pool);
server.setGracefulShutdown(1000);
server.setHandler(new AbstractHandler() {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setStatus(200);
response.getWriter().write("noop");
baseRequest.setHandled(true);
}
});
server.start();
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(8080);
server.addConnector(connector);
connector.start();
}
}
Here’s the apache benchmark information.
juniper:~ pivotal$ ab -n10000 -c20 -k http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: Jetty(7.2.2.v20101205)
Server Hostname: localhost
Server Port: 8080
Document Path: /
Document Length: 4 bytes
Concurrency Level: 20
Time taken for tests: 0.127 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 10000
Total transferred: 980392 bytes
HTML transferred: 40016 bytes
Requests per second: 78840.73 [#/sec] (mean)
Time per request: 0.254 [ms] (mean)
Time per request: 0.013 [ms] (mean, across all concurrent requests)
Transfer rate: 7548.32 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 0.1 0 3
Waiting: 0 0 0.1 0 3
Total: 0 0 0.1 0 3
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 1
100% 3 (longest request)
I’ve also been playing around with Mizuno and jruby-rack quite a bit recently. We’re hoping to find a high-performing solution for jruby.
Standup 3.23.2011: update your rvm, bundler 1.0.10 fix, autofocus in WebKit
Interesting things
Until yesterday rvm had bugs with double slashes in paths when doing an automatic install of a specific ruby when you cd to a directory. Grab the latest off github if you need this fix.
Updating Bundler 1.0.10 may result in parse errors if your yaml contains symbols. See this post for details: https://rails.lighthouseapp.com/projects/8994/tickets/6354-psych-does-not-handle-symbols- and try this in your
config/boot.rb:
require 'yaml' YAML::ENGINE.yamler= 'syck'
autofocusattribute +hovercss rule in WebKit may not play nicely with each other
Standup 3/22/2011: jQuery conference 2011
Interesting Things
- jQuery conference 2011 San Francisco will be April 16-17. More info here
Using Firebug with WebDriver in Capybara/Cucumber – New and Improved
Forget the steps I published earlier…just install the capybara-firebug gem and away you go.
Thanks jfirebaugh!
Standup 3.21.2011: Deactivating users in devise
Interesting Things
All strategies that inherit from Devise::Strategies::Authenticatable (which may be all right now) check for user.active?. To deactivate a user, just add an active column to User model, and a message to present with inactive_message:
# User model def active? !!active end def inactive_message "Sorry, this account has been deactivated." end
and to test:
# Any session controller spec
it "should throw an error with an inactive user" do
user = Factory.create(:user, :password => "password")
user.active = false
user.save!
error = catch(:warden) do
post :create, :user => {:username => user.username, :password => "password"}
end
error[:message].should =~ /deactivated/
end