Yingyi Bu has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/341

Change subject: Performance fix for BufferCache. The dpid of a page of file is 
calculated by fileid<<32 + pageid. But BufferCache.hash(long dpid) returns the 
hash value dpid%pageMap.length. In many cases,  the asterix configuration 
results in power-of-2 pageMap.length (b
......................................................................

Performance fix for BufferCache.
The dpid of a page of file is calculated by fileid<<32 + pageid.
But BufferCache.hash(long dpid) returns the hash value dpid%pageMap.length.
In many cases,  the asterix configuration results in power-of-2 pageMap.length 
(buffer-cache-size/page-size), which makes fileid useless.
That used to result in serious consequences: different partitions contend for 
the same cache bucket (which contains a link list of size #partitions) for most 
of the time and therefore the CPU couldn't be saturated.

Change-Id: I4afc406d612e569e23f65afdedc469459235ce7d
---
M 
hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/hyracks refs/changes/41/341/1

diff --git 
a/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
 
b/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
index 94ad801..9a18610 100644
--- 
a/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
+++ 
b/hyracks/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
@@ -441,7 +441,8 @@
     }
 
     private int hash(long dpid) {
-        return (int) (dpid % pageMap.length);
+        int hashValue = (int) (dpid ^ (dpid >>> 32));
+        return hashValue % pageMap.length;
     }
 
     private static class CacheBucket {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/341
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4afc406d612e569e23f65afdedc469459235ce7d
Gerrit-PatchSet: 1
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <[email protected]>

Reply via email to