You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/06/20 15:38:06 UTC

[GitHub] [zookeeper] larry-cdn77 commented on a diff in pull request #851: ZOOKEEPER-3311: Allow a delay to the transaction log flush

larry-cdn77 commented on code in PR #851:
URL: https://github.com/apache/zookeeper/pull/851#discussion_r901802640


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/SyncRequestProcessor.java:
##########
@@ -139,9 +163,12 @@ public void run() {
             // we do this in an attempt to ensure that not all of the servers
             // in the ensemble take a snapshot at the same time
             resetSnapshotStats();
+            lastFlushTime = Time.currentElapsedTime();
             while (true) {
-                Request si = queuedRequests.poll();
+                long pollTime = Math.min(zks.getMaxWriteQueuePollTime(), getRemainingDelay());
+                Request si = queuedRequests.poll(pollTime, TimeUnit.MILLISECONDS);

Review Comment:
   Could this `LinkedBlockingQueue.poll` lead to a fair amount of spinning when a non-zero `pollTime` is specified? In my use case in the order of ten thousand transactions/sec I have seen CPU usage explode from 3-5% to 30-40%, sending my adjoining ClickHouse cluster to its knees. I should add that total fsync time did improve 😄 



-- 
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: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org