Skip to content

Instantly share code, notes, and snippets.

from a separate instance
+-----------------------------------------------------------------------------+
| rate | conn/s | req/s | replies/s avg | errors | 5xx status | net io (KB/s) |
+-----------------------------------------------------------------------------+
| 10 | 9.9 | 9.9 | 9.8 | 12 | 1 | 173.1 |
| 20 | 18.2 | 18.2 | 15.1 | 246 | 1 | 223.6 |
| 30 | 26.1 | 26.1 | 0.0 | 1000 | 0 | 6.1 |
| 40 | 33.4 | 33.4 | 8.6 | 785 | 215 | 13.9 |
| 50 | 40.0 | 40.0 | 41.1 | 178 | 822 | 37.6 |
| 60 | 46.2 | 46.2 | 33.9 | 322 | 678 | 37.7 |
+-----------------------------------------------------------------------------+
| rate | conn/s | req/s | replies/s avg | errors | 5xx status | net io (KB/s) |
+-----------------------------------------------------------------------------+
| 10 | 9.5 | 9.5 | 7.3 | 269 | 0 | 141.5 |
| 20 | 18.2 | 18.2 | 0.8 | 960 | 0 | 23.2 |
| 30 | 26.1 | 26.1 | 0.0 | 1000 | 0 | 6.0 |
| 40 | 33.6 | 33.6 | 14.3 | 641 | 359 | 18.1 |
| 50 | 40.1 | 40.1 | 26.7 | 464 | 536 | 27.7 |
| 60 | 46.1 | 46.1 | 36.8 | 263 | 737 | 39.8 |
| 70 | 52.0 | 52.0 | 49.8 | 253 | 747 | 45.4 |
def where *params
shard_key = params.find{|x| x.has_key?(:player_id)}
params.first.merge!(:shard_id => Digest::MD5.hexdigest(shard_key[:player_id])) unless shard_key.nil?
super *params
end
# checking in console
ruby-1.9.2-p290 :079 > Activity.where(:player_id => "4e5d4e27b262e3fbe0000050").selector
=> {:deleted_at=>{"$exists"=>false}, :player_id=>BSON::ObjectId('4e5d4e27b262e3fbe0000050'), :shard_id=>"0ce2aee649f332e56751b41bc9e2844e"}
require 'rubygems'
require 'open-uri'
response = open(YOUR_URL_OF_REUEST)
p response.read
require 'rubygems'
require 'nokogiri'
require 'open-uri'
# can be different for your specific search
PAGES = 140
PAGES.times do |page_num|
response = open("http://www.match.com/search/searchSubmit.aspx?by=radius&lid=226&cl=1&gc=2&tr=1&lage=27&uage=29&ua=29&pc=94121&dist=10&po=1&oln=0&do=2&q=woman,men,27,29,1915822078&st=quicksearch&pn=#{page_num}&rn=4", "cookie" => "SECU=VALUE_OF_THE_COOKIE")
require 'rubygems'
require 'nokogiri'
require 'open-uri'
# can be different for your specific search
PAGES = 140
PAGES.times do |page_num|
response = open("http://www.match.com/search/searchSubmit.aspx?by=radius&lid=226&cl=1&gc=2&tr=1&lage=27&uage=29&ua=29&pc=94121&dist=10&po=1&oln=0&do=2&q=woman,men,27,29,1915822078&st=quicksearch&pn=#{page_num}&rn=4", "cookie" => "SECU=VALUE_OF_THE_COOKIE")
require 'nokogiri'
require 'eventmachine'
require 'em-http-request'
require 'em-redis'
PAGES = 140
EM.run {
@redis = EM::Protocols::Redis.connect
require 'redis'
require 'face'
# fb user_id of the user that needs to be find on match.com
FB_UID = '11111@facebook.com'
# show all profiles whith the given confidence of recognition
ACCURACY = 30
redis = Redis.new
require 'rubygems'
require 'redis'
require 'redis/distributed'
r = Redis::Distributed.new %w[redis://host1:6379 redis://host2:6379]
# show node for key "foo"
p r.node_for("foo")
# set the value of "foo"
require 'vertx'
server = Vertx::HttpServer.new;
sockJSServer = Vertx::SockJSServer.new(server)
sockJSServer.bridge({'prefix' => '/eventbus'}, [] )
server.listen(8080)