arya-pandemic 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1,6 +1,8 @@
1
1
  # Pandemic
2
2
  Pandemic is a map-reduce-ish framework. It allows you to partition requests and distribute them as you please, then process the request (or parts of it) on any number of nodes, and then reduce the response however you please. It's designed to serve requests in real-time, but can also be used for offline tasks.
3
3
 
4
+ One example of where it's currently being used is to do online analysis of user behavior to detect automation. It averages 200 requests per second (300 peak) across 6 nodes, each node dealing with millions of requests each day.
5
+
4
6
  It's different from the typical map-reduce framework in that it doesn't have a master-worker structure. Every node does can do everything. It's actually not strictly a map-reduce framework, it's a bit more lenient on what you can do to your data/request other than map and reduce.
5
7
 
6
8
  The framework is designed to be as flexible as possible, there is no rigid request format, or API, you can specify it however you want. You can send it http-style headers and a body, you can send it JSON, or you can even just send it a single line and have it do whatever you want. The only requirement is that you write your handler to appropriately act on the request and return the response.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('pandemic', '0.3.9') do |p|
5
+ Echoe.new('pandemic', '0.4.0') do |p|
6
6
  p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
7
7
  p.url = "https://github.com/arya/pandemic/"
8
8
  p.author = "Arya Asemanfar"
@@ -21,7 +21,8 @@ module Pandemic
21
21
  @request_number = @@request_count.inc
22
22
  @body = body
23
23
  @responses = []
24
- @responses_mutex = Mutex.new
24
+ @responses_mutex = Monitor.new
25
+ @waiter = @responses_mutex.new_cond
25
26
  @complete = false
26
27
  end
27
28
 
@@ -42,7 +43,7 @@ module Pandemic
42
43
  end
43
44
 
44
45
  def wakeup_waiting_thread
45
- @waiting_thread.wakeup if @waiting_thread && @waiting_thread.status == "sleep"
46
+ @waiter.signal if @waiter
46
47
  end
47
48
 
48
49
  def responses
@@ -57,18 +58,15 @@ module Pandemic
57
58
  end
58
59
 
59
60
  def wait_for_responses
60
- return if @complete
61
- @waiting_thread = Thread.current
62
- if Config.response_timeout <= 0
63
- Thread.stop
64
- else
65
- sleep Config.response_timeout
61
+ @responses_mutex.synchronize do
62
+ return if @complete
63
+ if Config.response_timeout <= 0
64
+ @waiter.wait
65
+ else
66
+ @waiter.wait(Config.response_timeout)
67
+ end
68
+ @responses.freeze
66
69
  end
67
- # there is a race case where if the sleep finishes,
68
- # and response comes in and has the mutex, and then array is frozen
69
- # it would be ideal to use monitor wait/signal here but the monitor implementation is currently flawed
70
- @responses_mutex.synchronize { @responses.freeze }
71
- @waiting_thread = nil
72
70
  end
73
71
 
74
72
  def hash
data/pandemic.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pandemic}
5
- s.version = "0.3.9"
5
+ s.version = "0.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Arya Asemanfar"]
9
- s.date = %q{2009-06-25}
9
+ s.date = %q{2009-07-06}
10
10
  s.description = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
11
11
  s.email = %q{aryaasemanfar@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arya-pandemic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-25 00:00:00 -07:00
12
+ date: 2009-07-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency