sashapolo commented on code in PR #5637:
URL: https://github.com/apache/ignite-3/pull/5637#discussion_r2044411169
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/SpeedBasedMemoryConsumptionThrottlingStrategy.java:
##########
@@ -154,10 +161,9 @@ private long computeParkTime(int cpWrittenPages, long
curNanoTime) {
* @return Estimation of work done (in pages).
*/
private int cpDonePagesEstimation(int cpWrittenPages) {
- // TODO: IGNITE-16879 - this only works correctly if time-to-write a
page is close to time-to-sync a page.
- // In reality, this does not seem to hold, which produces wrong
estimations. We could measure the real times
- // in Checkpointer and make this estimation a lot more precise.
- return (cpWrittenPages + cpSyncedPages()) / 2;
+ double coefficient = writeVsFsyncCoefficient;
+
+ return (int) (cpWrittenPages * coefficient + cpSyncedPages() * (1 -
coefficient));
Review Comment:
You need to update the javadoc
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/SpeedBasedMemoryConsumptionThrottlingStrategy.java:
##########
@@ -496,5 +506,35 @@ void reset() {
void finish() {
cpWriteSpeed.closeInterval();
threadIds.clear();
+
+ updateWriteVsFsyncCoefficient();
+ }
+
+ private void updateWriteVsFsyncCoefficient() {
+ CheckpointProgress progress = cpProgress.get();
+ assert progress != null;
+
+ if (progress.currentCheckpointPagesCount() == 0) {
+ return;
+ }
+
+ long pagesWriteTimeMillis = progress.getPagesWriteTimeMillis();
+ long fsyncTimeMillis = progress.getFsyncTimeMillis();
+
+ double coefficient = ((double) pagesWriteTimeMillis) /
(pagesWriteTimeMillis + fsyncTimeMillis);
+ if (isNaN(coefficient)) {
+ return;
+ }
+
+ double newCoefficient = writeVsFsyncCoefficient * 0.85 + coefficient *
0.15;
+
+ // Put it within reasonable bounds just in case.
Review Comment:
What do you mean by "reasonable" bounds?
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/SpeedBasedMemoryConsumptionThrottlingStrategy.java:
##########
@@ -496,5 +506,35 @@ void reset() {
void finish() {
cpWriteSpeed.closeInterval();
threadIds.clear();
+
+ updateWriteVsFsyncCoefficient();
+ }
+
+ private void updateWriteVsFsyncCoefficient() {
+ CheckpointProgress progress = cpProgress.get();
+ assert progress != null;
+
+ if (progress.currentCheckpointPagesCount() == 0) {
+ return;
+ }
+
+ long pagesWriteTimeMillis = progress.getPagesWriteTimeMillis();
+ long fsyncTimeMillis = progress.getFsyncTimeMillis();
+
+ double coefficient = ((double) pagesWriteTimeMillis) /
(pagesWriteTimeMillis + fsyncTimeMillis);
+ if (isNaN(coefficient)) {
+ return;
+ }
+
+ double newCoefficient = writeVsFsyncCoefficient * 0.85 + coefficient *
0.15;
Review Comment:
What's this about?
--
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]