You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var loosers = new HashMap[Array[Byte], (Array[Byte], List[RemoteActorProxy])]
to attempt to group loser keys. however, there are several issues with this
(1) Array[Byte]'s hashcode is identity based:
scala> val h = new collection.mutable.HashMap[Array[Byte], Int]
h: scala.collection.mutable.HashMap[Array[Byte],Int] = Map()
scala> h += ((Array(0,1,2), 1))
res0: h.type = Map(([B@1224b90,1))
scala> h contains Array(0, 1, 2)
res1: Boolean = false
we're not even taking advantage of this, since we don't have a bulk put request, but we process puts sequentially (albeit asynchronously)
for ((key, (data, servers)) <- handler.loosers) {
for (server <- servers) {
server !! PutRequest(key, Some(data))
}
}
so i propose either we
(1) considering the HashMaps into an ArrayBuffer for efficiency
(2) use a wrapper class around Array[Byte] which properly computes the hash code. then we can take advantage of this grouping by introducing a bulk put request
the current solution is sub-optimal compared to (1) or (2) b/c a) we don't group keys properly, b) even if we did we don't exploit the grouping
thoughts?
The text was updated successfully, but these errors were encountered:
RangeHandle uses a
var loosers = new HashMap[Array[Byte], (Array[Byte], List[RemoteActorProxy])]
to attempt to group loser keys. however, there are several issues with this
(1) Array[Byte]'s hashcode is identity based:
scala> val h = new collection.mutable.HashMap[Array[Byte], Int]
h: scala.collection.mutable.HashMap[Array[Byte],Int] = Map()
scala> h += ((Array(0,1,2), 1))
res0: h.type = Map(([B@1224b90,1))
scala> h contains Array(0, 1, 2)
res1: Boolean = false
for ((key, (data, servers)) <- handler.loosers) {
for (server <- servers) {
server !! PutRequest(key, Some(data))
}
}
so i propose either we
(1) considering the HashMaps into an ArrayBuffer for efficiency
(2) use a wrapper class around Array[Byte] which properly computes the hash code. then we can take advantage of this grouping by introducing a bulk put request
the current solution is sub-optimal compared to (1) or (2) b/c a) we don't group keys properly, b) even if we did we don't exploit the grouping
thoughts?
The text was updated successfully, but these errors were encountered: