amit-jain commented on code in PR #1155:
URL: https://github.com/apache/jackrabbit-oak/pull/1155#discussion_r1380003902


##########
oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CachingDataStoreTest.java:
##########
@@ -638,4 +644,41 @@ private void waitFinish() {
             e.printStackTrace();
         }
     }
+
+    @Test
+    public void performanceGetRecordIfStored() throws Exception {
+        tear();
+        final int iterations = 100;
+        final long backendResponseDelay = 4L;
+
+        final File f = copyToFile(randomStream(0, 4 * 1024), folder.newFile());
+        final String id = getIdForInputStream(f);
+        final DataIdentifier di = new DataIdentifier(id);
+
+        init(1, 64 * 1024 * 1024, 10, 0L, backendResponseDelay);
+        // we write directly to the backend because that's the situation we 
have in a shared remote datastore:
+        // the file was already written by a different datastore but isn't 
present in the datastore.cache.
+        backend.write(di, f);
+
+        long start = System.nanoTime();
+        for (int i = 0; i < iterations; ++i) {
+            LOG.trace("" + dataStore.getRecordIfStored(di)); // LOG.trace to 
avoid the call being optimised away
+        }
+        long timeUncached = System.nanoTime() - start;
+
+        tear();
+
+        init(1, 64 * 1024 * 1024, 10, 10000L, backendResponseDelay);
+        // we write directly to the backend because that's the situation we 
have in a shared remote datastore:
+        // the file was already written by a different datastore but isn't 
present in the datastore.cache.
+        backend.write(di, f);
+
+        start = System.nanoTime();
+        for (int i = 0; i < iterations; ++i) {
+            LOG.trace("" + dataStore.getRecordIfStored(di)); // LOG.trace to 
avoid the call being optimised away
+        }
+        long timeCached = System.nanoTime() - start;
+

Review Comment:
   yes. If you need to add test performance numbers maybe you can also add to 
oak-benchmarks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to