You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ibessonov (via GitHub)" <gi...@apache.org> on 2025/04/15 15:08:30 UTC

[PR] IGNITE-25155 Optimize aipersist and throttling code [ignite-3]

ibessonov opened a new pull request, #5645:
URL: https://github.com/apache/ignite-3/pull/5645

   https://issues.apache.org/jira/browse/IGNITE-25155
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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@ignite.apache.org

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


Re: [PR] IGNITE-25155 Optimize aipersist and throttling code [ignite-3]

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov merged PR #5645:
URL: https://github.com/apache/ignite-3/pull/5645


-- 
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@ignite.apache.org

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


Re: [PR] IGNITE-25155 Optimize aipersist and throttling code [ignite-3]

Posted by "Phillippko (via GitHub)" <gi...@apache.org>.
Phillippko commented on code in PR #5645:
URL: https://github.com/apache/ignite-3/pull/5645#discussion_r2046439609


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -105,7 +106,9 @@ long getSpeedOpsPerSec(long curNanoTime) {
     long getSpeedOpsPerSecReadOnly() {
         MeasurementInterval interval = measurementIntervalAtomicRef.get();
 
-        long curNanoTime = System.nanoTime();
+        long curNanoTime = interval == null || interval.endNanoTime == 0
+                ? System.nanoTime()
+                : interval.endNanoTime;
 
         return calcSpeed(interval, curNanoTime);

Review Comment:
   endNanoTime? 
   
   Current name doesn't reflect that we can take time from the interval



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -245,7 +273,7 @@ void finishInterval() {
     public long getAverage() {
         long time = System.nanoTime();
 
-        return avgMeasurementWithHistorical(interval(time), time);
+        return avgMeasurementWithHistorical(interval(false, time), time);

Review Comment:
   Now it can't start new interval, can it? "This method may start new interval measurement or switch current"



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/PersistentPageMemory.java:
##########
@@ -2177,8 +2193,9 @@ public void finishCheckpoint() {
      * Checks if the Checkpoint Buffer is currently close to exhaustion.
      */
     public boolean isCpBufferOverflowThresholdExceeded() {
-        if (writeThrottle != null) {
-            return writeThrottle.isCpBufferOverflowThresholdExceeded();
+        PagesWriteThrottlePolicy writeThrottle0 = writeThrottle;

Review Comment:
   ```suggestion
           PagesWriteThrottlePolicy writeThrottle = this.writeThrottle;
   ```



##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -163,12 +166,17 @@ private boolean isOutdated(@Nullable MeasurementInterval interval, long curNanoT
      * @param curNanoTime Current nano time.
      * @return Interval to use.
      */
-    private MeasurementInterval interval(long curNanoTime) {
+    @Contract("true, _ -> !null")
+    private MeasurementInterval interval(boolean canInit, long curNanoTime) {

Review Comment:
   please add param to javadoc



-- 
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@ignite.apache.org

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


Re: [PR] IGNITE-25155 Optimize aipersist and throttling code [ignite-3]

Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov commented on code in PR #5645:
URL: https://github.com/apache/ignite-3/pull/5645#discussion_r2046590936


##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/persistence/throttling/IntervalBasedMeasurement.java:
##########
@@ -245,7 +273,7 @@ void finishInterval() {
     public long getAverage() {
         long time = System.nanoTime();
 
-        return avgMeasurementWithHistorical(interval(time), time);
+        return avgMeasurementWithHistorical(interval(false, time), time);

Review Comment:
   I'll fix that



-- 
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@ignite.apache.org

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