mixed_gauge 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 710c53d91da41c8135d1fe2b2a0d2a90c5af4ffb
4
- data.tar.gz: 29123eafebf6b4056bdbe40eb6dfa207abbb89b9
3
+ metadata.gz: fe193d3c4bbc6e42d5c285a7fc0db71b0d9fd63e
4
+ data.tar.gz: 135ac4476a0fb604f1c073853a1cef51fc8602d6
5
5
  SHA512:
6
- metadata.gz: 5db5f80874c5e47b0da03c4929cbaec2a77fb7327fb2de0463437e2c5004e651a4a1d95a363f1e708a81a0579880602920d6399c5a08e74e41b0fe495d09f84c
7
- data.tar.gz: 5c1160538e29b86d50efd84e76cb8bfe6781ada302c7ca2c7de55e29873f2e3d91661f33bef542d8b27ba632eeca2f4065d44deb058331c45cd58f7909c820f2
6
+ metadata.gz: d3d30a1b8a4a637405393025144dfb8bfe450bb46bc01e37012c593d8ef5e97807bc2f18e7ebf690ea872ae5ad40eb74ea174bbea404e67a6b5e1eacc9db8c8f
7
+ data.tar.gz: 5b30aa9199b3d09a22e12c305c1b063a572843606422221c61efa62674df5d21f61d384d4b93be409eae3e9b8dd3310d7b4169658cf21902f1cd6aea75211f83
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG for mixed_gauge
2
2
 
3
+ ## 0.2.1
4
+ - Fix performance issue that `MixedGauge::Model.shard_for` is very slow.
5
+
3
6
  ## 0.2.0
4
7
  - Replace default hash function from MD5 to CRC32. CRC32 is more distributed
5
8
  for random data and more speedy than MD5.
data/README.md CHANGED
@@ -138,8 +138,10 @@ access_token.token #=> a generated token
138
138
 
139
139
  ## Advanced configuration
140
140
  ### Hash fucntion
141
- Register arbitrary hash function. Hash function must be a proc and
142
- must return integer.
141
+ Default hash fucntion is CRC32, which has better perfomance for this kind of
142
+ usecase.
143
+
144
+ But you can use arbitrary hash function like:
143
145
 
144
146
  ```ruby
145
147
  # gem install fnv
@@ -151,6 +153,12 @@ Mixedgauge.configure do |config|
151
153
  end
152
154
  ```
153
155
 
156
+ Suggested hash functions are:
157
+
158
+ - MurmurHash
159
+ - FNV Hash
160
+ - SuperFastHash
161
+
154
162
  ## Installation
155
163
 
156
164
  Add this line to your application's Gemfile:
@@ -9,7 +9,7 @@ module MixedGauge
9
9
  @connection_registry = {}
10
10
  end
11
11
 
12
- # @param [Range] slots
12
+ # @param [Range] slots Range consisted with Fixnum.
13
13
  def define_slots(slots)
14
14
  @slots = slots
15
15
  end
@@ -22,11 +22,12 @@ module MixedGauge
22
22
 
23
23
  def validate_config!
24
24
  # TODO
25
+ # validate non Fixnum slots.
25
26
  end
26
27
 
27
28
  # @return [Integer]
28
- def slot_count
29
- @slots.count
29
+ def slot_size
30
+ @slots.size
30
31
  end
31
32
 
32
33
  # @param [Integer] slot
@@ -10,7 +10,7 @@ module MixedGauge
10
10
  # @param [String] dist_key
11
11
  # @return [String] connection name
12
12
  def route(key)
13
- slot = hash_f(key) % @cluster_config.slot_count
13
+ slot = hash_f(key) % @cluster_config.slot_size
14
14
  @cluster_config.fetch(slot)
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  module MixedGauge
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixed_gauge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taiki Ono
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord