You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/05/05 08:11:59 UTC
[GitHub] [bookkeeper] lordcheng10 opened a new pull request, #3260: Optimize write cache:
lordcheng10 opened a new pull request, #3260:
URL: https://github.com/apache/bookkeeper/pull/3260
### Motivation
We often find that the two write caches are full, causing write requests to block:
<img width="1629" alt="image" src="https://user-images.githubusercontent.com/19296967/166885183-973d1d30-d692-4209-adb8-7849f4ffd73a.png">
The current write cache has only 2 blocks, which has the following deficiencies:
1. Insufficient use of cache: When half of the write cache is flushed, it must wait for all the data in the write cache to be flushed before it can be released. With the same write cache size, if we divide the write cache into multiple blocks, the cache resources can be released faster, preventing the write request from waiting too long for the cache resources to be released;
2. The current write cache is allocated according to the configured data directory, so that the write cache resources between directories cannot be shared. When the write cache resources corresponding to one directory continue to be full, it is possible that the cache resources of other directories are still relatively low. Idle, so that the full utilization of the write cache is not used;
### Changes
1.Two write caches become multi-cache blocks;
2.All data directories share write cache resources;
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1150619762
> > Sharing the write cache pool with all ledger disks may cause competition for write cache resources, and eventually cause some ledger writes starve to death because they cannot get the write cache.
> > Suppose there are 3 ledgers, corresponding to 3 disks data1, data2 and data3, and the write cache pool size is 6. The traffic on data1 is relatively high, and the number of applied write caches will be skewed toward data1. If a large number of disk reads occur in data1 at a certain time, the write performance of data1 decreases, causing the write cache of pending flush to increase. The write cache pool is exhausted, and other normal disks data2 and data3 will wait because the write cache cannot be obtained.
> > Maybe we need a proposal and send to the dev mail list to discuss.
> > @merlimat @eolivelli @dlg99 Please help take a look, thanks.
>
> OK
@hangc0276
discussion email: https://lists.apache.org/thread/25lz5g61vg3h4b3pzrny0vqhhyddy4rj
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Shoothzj commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
Shoothzj commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911104660
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -85,6 +91,15 @@ public class DbLedgerStorage implements LedgerStorage {
private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = (long) (0.25 * PlatformDependent.maxDirectMemory())
/ MB;
+
+ private static final long DEFAULT_COMMON_WRITE_CACHE_MAX_SIZE_MB =
+ (long) (0.25 * PlatformDependent.maxDirectMemory()) / MB;
Review Comment:
```suggestion
(long) (0.25 * PlatformDependent.estimateMaxDirectMemory()) / MB;
```
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1121068409
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119826165
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120127956
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119252329
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] hangc0276 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1195240927
ping @lordcheng10, Would you please rebase the master?
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160385220
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911567486
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheManager.java:
##########
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * The class that manages write cache.
+ */
+public class WriteCacheManager {
+ private static final LinkedBlockingQueue<WriteCache> commonWriteCacheQueue =
+ new LinkedBlockingQueue<>();
+ private Map<SingleDirectoryDbLedgerStorage, WriteCacheContainer> singleDirectoryWriteCacheMap =
+ new ConcurrentHashMap<>();
+
+ public WriteCacheManager(long commonWriteCacheMaxSize, long commonWriteCacheBlockNum, ByteBufAllocator allocator) {
+ long commonWriteCacheBlockSize = commonWriteCacheMaxSize / commonWriteCacheBlockNum;
+ for (int i = 0; i < commonWriteCacheMaxSize / commonWriteCacheBlockSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator, commonWriteCacheBlockSize);
+ commonWriteCacheQueue.add(writeCache);
+ }
+ }
+
+ public static LinkedBlockingQueue<WriteCache> getCommonWriteCacheQueue() {
+ return commonWriteCacheQueue;
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
OK,I will fix
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -85,6 +91,15 @@ public class DbLedgerStorage implements LedgerStorage {
private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = (long) (0.25 * PlatformDependent.maxDirectMemory())
/ MB;
+
+ private static final long DEFAULT_COMMON_WRITE_CACHE_MAX_SIZE_MB =
+ (long) (0.25 * PlatformDependent.maxDirectMemory()) / MB;
Review Comment:
OK
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118474879
Have added a unit test for multiple write cache.
PTAL,thanks! @eolivelli
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119825875
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120109035
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119210370
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1141032211
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160358297
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1195316479
> ping @lordcheng10, Would you please rebase the master?
OK
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160604792
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118719482
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118294154
@hangc0276 @eolivelli @StevenLuMT PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911252702
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java:
##########
@@ -132,15 +145,15 @@ public void writeCacheFull() throws Exception {
assertEquals("key", new String(storage.readMasterKey(4)));
// Add enough entries to fill the 1st write cache
- for (int i = 0; i < 5; i++) {
+ for (int i = 0; i < 10; i++) {
Review Comment:
To test multiple write cache blocks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Shoothzj commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
Shoothzj commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911129327
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheManager.java:
##########
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * The class that manages write cache.
+ */
+public class WriteCacheManager {
+ private static final LinkedBlockingQueue<WriteCache> commonWriteCacheQueue =
+ new LinkedBlockingQueue<>();
+ private Map<SingleDirectoryDbLedgerStorage, WriteCacheContainer> singleDirectoryWriteCacheMap =
+ new ConcurrentHashMap<>();
+
+ public WriteCacheManager(long commonWriteCacheMaxSize, long commonWriteCacheBlockNum, ByteBufAllocator allocator) {
+ long commonWriteCacheBlockSize = commonWriteCacheMaxSize / commonWriteCacheBlockNum;
+ for (int i = 0; i < commonWriteCacheMaxSize / commonWriteCacheBlockSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator, commonWriteCacheBlockSize);
+ commonWriteCacheQueue.add(writeCache);
+ }
+ }
+
+ public static LinkedBlockingQueue<WriteCache> getCommonWriteCacheQueue() {
+ return commonWriteCacheQueue;
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
```suggestion
void disableFlushWriteCacheThread() {
```
I think we don't need public
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911621349
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheManager.java:
##########
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * The class that manages write cache.
+ */
+public class WriteCacheManager {
+ private static final LinkedBlockingQueue<WriteCache> commonWriteCacheQueue =
+ new LinkedBlockingQueue<>();
+ private Map<SingleDirectoryDbLedgerStorage, WriteCacheContainer> singleDirectoryWriteCacheMap =
+ new ConcurrentHashMap<>();
+
+ public WriteCacheManager(long commonWriteCacheMaxSize, long commonWriteCacheBlockNum, ByteBufAllocator allocator) {
+ long commonWriteCacheBlockSize = commonWriteCacheMaxSize / commonWriteCacheBlockNum;
+ for (int i = 0; i < commonWriteCacheMaxSize / commonWriteCacheBlockSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator, commonWriteCacheBlockSize);
+ commonWriteCacheQueue.add(writeCache);
+ }
+ }
+
+ public static LinkedBlockingQueue<WriteCache> getCommonWriteCacheQueue() {
+ return commonWriteCacheQueue;
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
Fixed
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118370584
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911252702
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java:
##########
@@ -132,15 +145,15 @@ public void writeCacheFull() throws Exception {
assertEquals("key", new String(storage.readMasterKey(4)));
// Add enough entries to fill the 1st write cache
- for (int i = 0; i < 5; i++) {
+ for (int i = 0; i < 10; i++) {
Review Comment:
To test multiple write cache blocks,added 10 shared write cache blocks:
<img width="777" alt="image" src="https://user-images.githubusercontent.com/19296967/176827011-5c8bec09-9491-4006-a095-97d19b746d50.png">
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Shoothzj commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
Shoothzj commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911129980
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java:
##########
@@ -132,15 +145,15 @@ public void writeCacheFull() throws Exception {
assertEquals("key", new String(storage.readMasterKey(4)));
// Add enough entries to fill the 1st write cache
- for (int i = 0; i < 5; i++) {
+ for (int i = 0; i < 10; i++) {
Review Comment:
why we need to change former tests?
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1140848004
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120960227
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1121937543
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1127852128
> Sharing the write cache pool with all ledger disks may cause competition for write cache resources, and eventually cause some ledger writes starve to death because they cannot get the write cache.
>
> Suppose there are 3 ledgers, corresponding to 3 disks data1, data2 and data3, and the write cache pool size is 6. The traffic on data1 is relatively high, and the number of applied write caches will be skewed toward data1. If a large number of disk reads occur in data1 at a certain time, the write performance of data1 decreases, causing the write cache of pending flush to increase. The write cache pool is exhausted, and other normal disks data2 and data3 will wait because the write cache cannot be obtained.
>
> Maybe we need a proposal and send to the dev mail list to discuss.
>
> @merlimat @eolivelli @dlg99 Please help take a look, thanks.
OK, I will fixed.
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160339061
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160370897
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160371966
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1161287445
@merlimat PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1159774122
> Sharing the write cache pool with all ledger disks may cause competition for write cache resources, and eventually cause some ledger writes starve to death because they cannot get the write cache.
For this purpose, I designed an exclusive cache pool for the data directory and a cache pool shared by all directories.
The reconstructed architecture diagram is as follows:
<img width="913" alt="image" src="https://user-images.githubusercontent.com/19296967/174257631-00d8959d-1506-458b-90e5-af685c3af4c1.png">
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160461165
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119329214
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r865707934
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -432,6 +447,19 @@ static long getLongVariableOrDefault(ServerConfiguration conf, String keyName, l
}
}
+ static int getIntVariableOrDefault(ServerConfiguration conf, String keyName, int defaultValue) {
Review Comment:
Fixed.
PTAL,thanks! @eolivelli
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -441,7 +468,16 @@ private void triggerFlushAndAddEntry(long ledgerId, long entryId, ByteBuf entry)
// Write cache is full, we need to trigger a flush so that it gets rotated
// If the flush has already been triggered or flush has already switched the
// cache, we don't need to trigger another flush
- if (!isFlushOngoing.get() && hasFlushBeenTriggered.compareAndSet(false, true)) {
+ if (maxPendingFlushCacheNum.tryAcquire() && hasFlushBeenTriggered.compareAndSet(false, true)) {
Review Comment:
Fixed.
PTAL,thanks! @eolivelli
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import io.netty.buffer.ByteBufAllocator;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * Manage free write cache blocks.
+ */
+public class WriteCacheContainer {
+ private volatile LinkedBlockingQueue<WriteCache> freeBlockCaches = new LinkedBlockingQueue<>();
Review Comment:
Fixed.
PTAL,thanks! @eolivelli
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r865705053
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -441,7 +468,16 @@ private void triggerFlushAndAddEntry(long ledgerId, long entryId, ByteBuf entry)
// Write cache is full, we need to trigger a flush so that it gets rotated
// If the flush has already been triggered or flush has already switched the
// cache, we don't need to trigger another flush
- if (!isFlushOngoing.get() && hasFlushBeenTriggered.compareAndSet(false, true)) {
+ if (maxPendingFlushCacheNum.tryAcquire() && hasFlushBeenTriggered.compareAndSet(false, true)) {
Review Comment:
like this?
if (hasFlushBeenTriggered.compareAndSet(false, true) && maxPendingFlushCacheNum.tryAcquire()){
.....
}
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118720395
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120140533
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120450149
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1196637985
> ping @lordcheng10, Would you please rebase the master?
Fixed,PTAL,thanks! @hangc0276
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160545478
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1159779978
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911621277
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -85,6 +91,15 @@ public class DbLedgerStorage implements LedgerStorage {
private static final long DEFAULT_WRITE_CACHE_MAX_SIZE_MB = (long) (0.25 * PlatformDependent.maxDirectMemory())
/ MB;
+
+ private static final long DEFAULT_COMMON_WRITE_CACHE_MAX_SIZE_MB =
+ (long) (0.25 * PlatformDependent.maxDirectMemory()) / MB;
Review Comment:
Fixed
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,367 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.io.IOException;
+import java.util.NoSuchElementException;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.StampedLock;
+import org.apache.bookkeeper.bookie.BookieCriticalThread;
+import org.apache.bookkeeper.bookie.CheckpointSource;
+import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
+import org.apache.bookkeeper.bookie.storage.EntryLogger;
+import org.apache.bookkeeper.stats.Counter;
+import org.apache.bookkeeper.stats.OpStatsLogger;
+import org.apache.bookkeeper.util.MathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Container for storing write cache blocks.
+ */
+public class WriteCacheContainer {
+ protected static final Logger LOG = LoggerFactory.getLogger(WriteCacheContainer.class);
+
+ private final LinkedBlockingQueue<WriteCache> freeBlockCaches = new LinkedBlockingQueue<>();
+
+ protected LinkedBlockingDeque<WriteCache> fulledBlockCaches = new LinkedBlockingDeque<>();
+
+ protected final ReentrantLock flushMutex = new ReentrantLock();
+
+ private CheckpointSource.Checkpoint lastCheckpoint = CheckpointSource.Checkpoint.MIN;
+
+ protected CheckpointSource checkpointSource = CheckpointSource.DEFAULT;
+
+ private EntryLogger entryLogger;
+
+ private LedgerMetadataIndex ledgerIndex;
+ private EntryLocationIndex entryLocationIndex;
+
+ private DbLedgerStorageStats dbLedgerStorageStats;
+
+ protected final Counter flushExecutorTime;
+
+ private final ScheduledExecutorService cleanupExecutor;
+
+ private FlushWriteCacheThread flushWriteCacheThread;
+
+ private final AtomicLong cacheSize = new AtomicLong(0);
+
+ private final LongAdder cacheCount = new LongAdder();
+
+ private final StampedLock rotationLock = new StampedLock();
+
+ private final AtomicBoolean disableFlushWriteCacheThread = new AtomicBoolean(false);
+
+
+ public WriteCacheContainer(EntryLogger entryLogger,
+ LedgerMetadataIndex ledgerIndex,
+ EntryLocationIndex entryLocationIndex,
+ DbLedgerStorageStats dbLedgerStorageStats,
+ ScheduledExecutorService cleanupExecutor,
+ Counter flushExecutorTime,
+ long writeCacheSize,
+ long perDirectoryBlockWriteCacheSize,
+ ByteBufAllocator allocator) {
+ this.entryLogger = entryLogger;
+ this.ledgerIndex = ledgerIndex;
+ this.entryLocationIndex = entryLocationIndex;
+ this.dbLedgerStorageStats = dbLedgerStorageStats;
+ this.cleanupExecutor = cleanupExecutor;
+ this.flushExecutorTime = flushExecutorTime;
+ for (int i = 0; i < writeCacheSize / perDirectoryBlockWriteCacheSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator,
+ perDirectoryBlockWriteCacheSize);
+ writeCache.isSingleDirectoryWriteCache(true);
+ freeBlockCaches.add(writeCache);
+ }
+ flushWriteCacheThread = new FlushWriteCacheThread("flush-write-cache-thread");
+ flushWriteCacheThread.start();
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
Fixed.
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1171947587
Fixed! PTAL,thanks! @Shoothzj
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1172850792
PTAL,thanks! @merlimat @hangc0276 @eolivelli
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120087245
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120156293
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120431823
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911615444
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,367 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.io.IOException;
+import java.util.NoSuchElementException;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.StampedLock;
+import org.apache.bookkeeper.bookie.BookieCriticalThread;
+import org.apache.bookkeeper.bookie.CheckpointSource;
+import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
+import org.apache.bookkeeper.bookie.storage.EntryLogger;
+import org.apache.bookkeeper.stats.Counter;
+import org.apache.bookkeeper.stats.OpStatsLogger;
+import org.apache.bookkeeper.util.MathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Container for storing write cache blocks.
+ */
+public class WriteCacheContainer {
+ protected static final Logger LOG = LoggerFactory.getLogger(WriteCacheContainer.class);
+
+ private final LinkedBlockingQueue<WriteCache> freeBlockCaches = new LinkedBlockingQueue<>();
+
+ protected LinkedBlockingDeque<WriteCache> fulledBlockCaches = new LinkedBlockingDeque<>();
+
+ protected final ReentrantLock flushMutex = new ReentrantLock();
+
+ private CheckpointSource.Checkpoint lastCheckpoint = CheckpointSource.Checkpoint.MIN;
+
+ protected CheckpointSource checkpointSource = CheckpointSource.DEFAULT;
+
+ private EntryLogger entryLogger;
+
+ private LedgerMetadataIndex ledgerIndex;
+ private EntryLocationIndex entryLocationIndex;
+
+ private DbLedgerStorageStats dbLedgerStorageStats;
+
+ protected final Counter flushExecutorTime;
+
+ private final ScheduledExecutorService cleanupExecutor;
+
+ private FlushWriteCacheThread flushWriteCacheThread;
+
+ private final AtomicLong cacheSize = new AtomicLong(0);
+
+ private final LongAdder cacheCount = new LongAdder();
+
+ private final StampedLock rotationLock = new StampedLock();
+
+ private final AtomicBoolean disableFlushWriteCacheThread = new AtomicBoolean(false);
+
+
+ public WriteCacheContainer(EntryLogger entryLogger,
+ LedgerMetadataIndex ledgerIndex,
+ EntryLocationIndex entryLocationIndex,
+ DbLedgerStorageStats dbLedgerStorageStats,
+ ScheduledExecutorService cleanupExecutor,
+ Counter flushExecutorTime,
+ long writeCacheSize,
+ long perDirectoryBlockWriteCacheSize,
+ ByteBufAllocator allocator) {
+ this.entryLogger = entryLogger;
+ this.ledgerIndex = ledgerIndex;
+ this.entryLocationIndex = entryLocationIndex;
+ this.dbLedgerStorageStats = dbLedgerStorageStats;
+ this.cleanupExecutor = cleanupExecutor;
+ this.flushExecutorTime = flushExecutorTime;
+ for (int i = 0; i < writeCacheSize / perDirectoryBlockWriteCacheSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator,
+ perDirectoryBlockWriteCacheSize);
+ writeCache.isSingleDirectoryWriteCache(true);
+ freeBlockCaches.add(writeCache);
+ }
+ flushWriteCacheThread = new FlushWriteCacheThread("flush-write-cache-thread");
+ flushWriteCacheThread.start();
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
OK
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911252702
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java:
##########
@@ -132,15 +145,15 @@ public void writeCacheFull() throws Exception {
assertEquals("key", new String(storage.readMasterKey(4)));
// Add enough entries to fill the 1st write cache
- for (int i = 0; i < 5; i++) {
+ for (int i = 0; i < 10; i++) {
Review Comment:
To test multiple write cache blocks:
<img width="777" alt="image" src="https://user-images.githubusercontent.com/19296967/176827011-5c8bec09-9491-4006-a095-97d19b746d50.png">
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1170896783
PTAL,thanks ! @eolivelli @Ghatage @merlimat @rdhabalia @reddycharan @Shoothzj @zymap
**We replaced a node in the online bookie cluster. Under the same traffic, the comparison of the delay before and after is as follows:**
<img width="1629" alt="image" src="https://user-images.githubusercontent.com/19296967/176624763-32ff6cfd-09a3-4b26-8c67-69e6359e23b5.png">
<img width="1307" alt="image" src="https://user-images.githubusercontent.com/19296967/176624684-a7465965-1dc8-4bdb-884a-37a8f7bcc9e3.png">
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] StevenLuMT commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
StevenLuMT commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1225342083
fix old workflow,please see #3455 for detail
--
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: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Shoothzj commented on a diff in pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
Shoothzj commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r911109951
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,367 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import com.google.common.annotations.VisibleForTesting;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufAllocator;
+import java.io.IOException;
+import java.util.NoSuchElementException;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.StampedLock;
+import org.apache.bookkeeper.bookie.BookieCriticalThread;
+import org.apache.bookkeeper.bookie.CheckpointSource;
+import org.apache.bookkeeper.bookie.CheckpointSource.Checkpoint;
+import org.apache.bookkeeper.bookie.storage.EntryLogger;
+import org.apache.bookkeeper.stats.Counter;
+import org.apache.bookkeeper.stats.OpStatsLogger;
+import org.apache.bookkeeper.util.MathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Container for storing write cache blocks.
+ */
+public class WriteCacheContainer {
+ protected static final Logger LOG = LoggerFactory.getLogger(WriteCacheContainer.class);
+
+ private final LinkedBlockingQueue<WriteCache> freeBlockCaches = new LinkedBlockingQueue<>();
+
+ protected LinkedBlockingDeque<WriteCache> fulledBlockCaches = new LinkedBlockingDeque<>();
+
+ protected final ReentrantLock flushMutex = new ReentrantLock();
+
+ private CheckpointSource.Checkpoint lastCheckpoint = CheckpointSource.Checkpoint.MIN;
+
+ protected CheckpointSource checkpointSource = CheckpointSource.DEFAULT;
+
+ private EntryLogger entryLogger;
+
+ private LedgerMetadataIndex ledgerIndex;
+ private EntryLocationIndex entryLocationIndex;
+
+ private DbLedgerStorageStats dbLedgerStorageStats;
+
+ protected final Counter flushExecutorTime;
+
+ private final ScheduledExecutorService cleanupExecutor;
+
+ private FlushWriteCacheThread flushWriteCacheThread;
+
+ private final AtomicLong cacheSize = new AtomicLong(0);
+
+ private final LongAdder cacheCount = new LongAdder();
+
+ private final StampedLock rotationLock = new StampedLock();
+
+ private final AtomicBoolean disableFlushWriteCacheThread = new AtomicBoolean(false);
+
+
+ public WriteCacheContainer(EntryLogger entryLogger,
+ LedgerMetadataIndex ledgerIndex,
+ EntryLocationIndex entryLocationIndex,
+ DbLedgerStorageStats dbLedgerStorageStats,
+ ScheduledExecutorService cleanupExecutor,
+ Counter flushExecutorTime,
+ long writeCacheSize,
+ long perDirectoryBlockWriteCacheSize,
+ ByteBufAllocator allocator) {
+ this.entryLogger = entryLogger;
+ this.ledgerIndex = ledgerIndex;
+ this.entryLocationIndex = entryLocationIndex;
+ this.dbLedgerStorageStats = dbLedgerStorageStats;
+ this.cleanupExecutor = cleanupExecutor;
+ this.flushExecutorTime = flushExecutorTime;
+ for (int i = 0; i < writeCacheSize / perDirectoryBlockWriteCacheSize; i++) {
+ WriteCache writeCache = new WriteCache(allocator,
+ perDirectoryBlockWriteCacheSize);
+ writeCache.isSingleDirectoryWriteCache(true);
+ freeBlockCaches.add(writeCache);
+ }
+ flushWriteCacheThread = new FlushWriteCacheThread("flush-write-cache-thread");
+ flushWriteCacheThread.start();
+ }
+
+ @VisibleForTesting
+ public void disableFlushWriteCacheThread() {
Review Comment:
```suggestion
void disableFlushWriteCacheThread() {
```
I think we don't need public
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120101038
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118398458
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120542585
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120109015
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120087349
Have added a unit test for multiple write cache.
PTAL,thanks! @eolivelli
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] eolivelli commented on a diff in pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
eolivelli commented on code in PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#discussion_r865692952
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java:
##########
@@ -432,6 +447,19 @@ static long getLongVariableOrDefault(ServerConfiguration conf, String keyName, l
}
}
+ static int getIntVariableOrDefault(ServerConfiguration conf, String keyName, int defaultValue) {
Review Comment:
this should be moved to ServerConfiguration
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/SingleDirectoryDbLedgerStorage.java:
##########
@@ -441,7 +468,16 @@ private void triggerFlushAndAddEntry(long ledgerId, long entryId, ByteBuf entry)
// Write cache is full, we need to trigger a flush so that it gets rotated
// If the flush has already been triggered or flush has already switched the
// cache, we don't need to trigger another flush
- if (!isFlushOngoing.get() && hasFlushBeenTriggered.compareAndSet(false, true)) {
+ if (maxPendingFlushCacheNum.tryAcquire() && hasFlushBeenTriggered.compareAndSet(false, true)) {
Review Comment:
if `hasFlushBeenTriggered.compareAndSet(false, true)` returns `false` we may miss to release `maxPendingFlushCacheNum`
because `maxPendingFlushCacheNum.tryAcquire()` succeeded
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheContainer.java:
##########
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.bookkeeper.bookie.storage.ldb;
+
+import io.netty.buffer.ByteBufAllocator;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * Manage free write cache blocks.
+ */
+public class WriteCacheContainer {
+ private volatile LinkedBlockingQueue<WriteCache> freeBlockCaches = new LinkedBlockingQueue<>();
Review Comment:
why `volatile` ? it should be `final`
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] hangc0276 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
hangc0276 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1123924412
Sharing the write cache pool with all ledger disks may cause competition for write cache resources, and eventually cause some ledger writes starve to death because they cannot get the write cache.
Suppose there are 3 ledgers, corresponding to 3 disks data1, data2 and data3, and the write cache pool size is 6. The traffic on data1 is relatively high, and the number of applied write caches will be skewed toward data1. If a large number of disk reads occur in data1 at a certain time, the write performance of data1 decreases, causing the write cache of pending flush to increase. The write cache pool is exhausted, and other normal disks data2 and data3 will wait because the write cache cannot be obtained.
Maybe we need a proposal and send to the dev mail list to discuss.
@merlimat @eolivelli @dlg99 Please help take a look, thanks.
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1129691487
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1180061457
Ping
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1118403890
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119182567
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1119200031
/pulsarbot run-failure-checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1120087582
@hangc0276 @eolivelli @StevenLuMT @merlimat @codelipenghui PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:①Two write caches become multi-cache blocks;②All data directories share write cache resources;
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1140804567
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:Two write caches become multi-cache blocks
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1158629539
@merlimat PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache:Two write caches become multi-cache blocks
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1158662862
@dlg99 @eolivelli @pkumar-singh @zymap PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1160696500
rerun failure checks
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] lordcheng10 commented on pull request #3260: Optimize write cache: supports configuring multiple caches
Posted by GitBox <gi...@apache.org>.
lordcheng10 commented on PR #3260:
URL: https://github.com/apache/bookkeeper/pull/3260#issuecomment-1162522462
@dlg99 PTAL,thanks!
--
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: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org