Skip to content

Instantly share code, notes, and snippets.

@bbrowning
bbrowning / jubilee
Created January 3, 2014 19:18
jubilee vs torqbox performance on techempower json benchmark after warmup period
# Jubille started with:
# jubilee -p 8080 -e production
#
# Note that the Jubilee console outputs quite a few errors like below during
# the test:
#
# Jan 03, 2014 2:15:31 PM org.vertx.java.core.logging.impl.JULLogDelegate error
# SEVERE: Unhandled exception
# java.nio.channels.ClosedChannelException
@bbrowning
bbrowning / config.ru
Created November 8, 2013 21:49
Poor Puma performance with keepalives enabled on JRuby. For both 'ab' runs, Puma was warmed up before running the actual test shown.
run lambda { |env|
[200, { 'Content-Type' => 'text/plain' }, ["hello world\n"]]
}
source 'https://rubygems.org'
gem 'jruby-openssl', '0.9.3'
@bbrowning
bbrowning / instructions.md
Last active December 20, 2015 23:49
OpenShift pre_build hook to allow Windows developers to deploy to OpenShift
  1. Make sure your Gemfile.lock is not committed to your OpenShift git repository.

  2. Copy the pre_build file to .openshift/action_hooks/pre_build

  3. Add .openshift/action_hooks/pre_build to git, set the executable bit, and push your changes

    git add .openshift/action_hooks/pre_build git update-index --chmod=+x .openshift/action_hooks/pre_build git commit -m "Add bundle_install in pre_build hook" git push

class MessagingStatsService
def start
Thread.new do
until @done
queues.each do |queue|
counter = org.hornetq.api.core.management.MessageCounterInfo.from_json(queue.list_message_counter)
puts "Queue #{queue.name} count: #{counter.count} countDelta: #{counter.count_delta} depth: #{counter.depth} depth_delta: #{counter.depth_delta}"
end
end
require 'erb'
NUM_THREADS = 400
puts "Thread with string"
threads = NUM_THREADS.times.map {
Thread.new do
'1'
end
}
@bbrowning
bbrowning / output
Last active December 12, 2015 07:59
bbrowning@bbrowning-mbp:~$ curl -I http://localhost:8080/posts/
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: foobar=k5wDvCA2jZvAlwqb2HgFMdsX; Domain=foobar.com; Expires=Fri, 08-Feb-2013 18:17:44 GMT; Path=/baz; Secure; HttpOnly
X-UA-Compatible: IE=Edge
ETag: "903b327bb0b526d7d9b6b4d8344fc56f"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 9cac85c7ee32c524896767ff8ce730ca
X-Runtime: 0.796000
Content-Type: text/html;charset=utf-8
@bbrowning
bbrowning / proxy.diff
Created February 4, 2013 17:14
Maven RubyGems proxy fix
diff --git a/gem-proxy/src/main/java/de/saumya/mojo/proxy/Controller.java b/gem-proxy/src/main/java/de/saumya/mojo/proxy/Controller.java
index a9a46b5..0e54554 100644
--- a/gem-proxy/src/main/java/de/saumya/mojo/proxy/Controller.java
+++ b/gem-proxy/src/main/java/de/saumya/mojo/proxy/Controller.java
@@ -31,7 +31,7 @@ public class Controller {
private static final String SHA1 = ".sha1";
- private static final String RUBYGEMS_URL = "http://rubygems.org/gems";
+ private static final String RUBYGEMS_URL = "https://rubygems.org/gems";
@bbrowning
bbrowning / highspeedpublish.rb
Created January 8, 2013 19:59
Example of publishing messages at a high speed with TorqueBox
queue = TorqueBox::Messaging::Queue.new('/queue/foo')
options = { :startup_timeout => 500, :persistent => false, :tx => false }
normalized_options = queue.normalize_options(options)
queue.wait_for_destination(options[:startup_timeout]) do
queue.with_session(options) do |session|
# loop here and publish each message
5.times { session.publish(queue, Time.now.to_s, normalized_options) }
end
end
TORQUEBOX_SERVER=standalone.xml
TORQUEBOX_HOME=/opt/torquebox
RUN=yes