Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

notes

  • Loading branch information...
commit 645ff5705c986b38f7a6c27e95c85e0c411a52dd 1 parent 472ce9d
Nick Kallen authored
Showing with 19 additions and 15 deletions.
  1. +4 −2 jb
  2. +13 −11 talk_outline.txt
  3. +2 −2 util/in_process_lru_cache.rb
View
6 jb
@@ -24,13 +24,15 @@ end
count_per_worker = $options[:count] / $options[:concurrency]
+requests = (1..10).to_a
+
benchmark = Benchmark.measure do
threads = []
- $options[:concurrency].times do |request|
+ $options[:concurrency].times do
threads << Thread.new do
socket = TCPSocket.new($options[:host], $options[:port])
count_per_worker.times do
- socket.print("#{request}\n")
+ socket.print("#{requests.rand}\n")
socket.readline
end
end
View
24 talk_outline.txt
@@ -1,24 +1,26 @@
-Theme #1: Distribution, Balance, and Locality
+# Distribution, Balance, and Locality
-Introduction: A Basic Network Service
+# Introduction:
+Who am I?
+Talk outline
# Distribution
+Simple Network Service with EventMachine
Load Test Service
Explain concept of IO vs CPU time
+Collect statistics
Calculate the optimal # of workers per core
# Load Balancing
+Alternatives: proxy, ketama, dns, p2p
Write a Proxy
-Show Round-Robin, Random, and By-busyness
+Propagate transaction-id through system
+Show Round-Robin, Random, and LeastConnections strategies
# Locality
+Distributed Memory Hierarchy / Computation Hierarchy
Cache results in-process
-Fallback to network cache
-Compute
-Proxy without stickyness
-Proxy with stickyness
+Examples of Locality
+Achieve locality with Sticky strategy
-# Other Balancing Schemes
-Client-side Partitioning
-Peer-to-Peer
-Name Server
+Questions?
View
4 util/in_process_lru_cache.rb
@@ -5,14 +5,14 @@ def get(data)
data == key
end
if !cache_hit
- $stats.set('cache_hit', 0)
+ $stats.set('cache_hit', 0.0)
result = yield(data)
@cache.unshift([data, result])
@cache.slice!(2..-1)
result
else
- $stats.set('cache_hit', 1)
+ $stats.set('cache_hit', 1.0)
cache_hit[1]
end
Please sign in to comment.
Something went wrong with that request. Please try again.