sijie commented on a change in pull request #1808: Allow to configure sticky 
reads
URL: https://github.com/apache/bookkeeper/pull/1808#discussion_r232922098
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/PendingReadOp.java
 ##########
 @@ -96,13 +96,38 @@
             this.ensemble = ensemble;
             this.eId = eId;
 
+            long entryIdToConsiderForWriteSet = eId;
+
+            if (clientCtx.getConf().enableStickyReads
+                    && lh.getLedgerMetadata().getWriteQuorumSize() == 
lh.getLedgerMetadata().getEnsembleSize()) {
+                // When sticky reads are enabled we want to make sure to take
+                // advantage of read-ahead (or, anyway, from effciencies in
+                // reading sequential data from disk through the page cache).
+                // For this, all the entries that a given bookie prefetches,
+                // should read from that bookie.
+                // For example, with e=2, w=2, a=2 we would have
+                //      B-1   B-2
+                // e-0   X     X
+                // e-1   X     X
+                // e-2   X     X
+                //
+                // In this case we want all the requests to be issued to B-1 
(by
+                // preference), so that cache hits will be maximized.
+                //
+                // We can only enable sticky reads if the ensemble==writeQuorum
+                // otherwise the same bookie will not have all the entries
+                // stored
+                entryIdToConsiderForWriteSet = 0;
 
 Review comment:
   the change is to pick a "sticky" bookie. the idea here is to pick a fixed 
"write set" (a certain  read order). the write set is a sequence of bookie 
index not fixed bookie addresses, so there is nothing to worry about about 
"ensemble changes".

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to