You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2022/05/11 15:24:58 UTC

[GitHub] [geode] jvarenina commented on pull request #7378: GEODE-10056: Improve gateway-receiver load balance

jvarenina commented on PR #7378:
URL: https://github.com/apache/geode/pull/7378#issuecomment-1123927160

   
   This PR has been hanging for a long time now, and we should decide whether to close it or merge it.
   
   I think this PR adds value to Apache geode if we at least "synchronize" sending of CacheServerLoadMessage on all servers. Current 5 seconds possible difference is just too much. I think this could be done with the following simple not so smart algorithm: 
   
   ```
   
   @@ -159,17 +159,24 @@ public class LoadMonitor implements ConnectionListener {
          }
        }
    
   +    long getSynchronizedServerTimeWaitInterval() {
   +      long currentTimeMills = System.currentTimeMillis();
   +      long serversSynchronizedTime = (currentTimeMills - (currentTimeMills % pollInterval)) + pollInterval;
   +      return serversSynchronizedTime - currentTimeMills;
   +    }
   +
        @Override
        public void run() {
          while (alive) {
            try {
              synchronized (signal) {
   -            long end = System.currentTimeMillis() + pollInterval;
   -            long remaining = pollInterval;
   -            while (alive && remaining > 0) {
   -              signal.wait(remaining);
   -              remaining = end - System.currentTimeMillis();
   +            long toWaitInterval = 0;
   +            while(toWaitInterval <= 0) {
   +              toWaitInterval = getSynchronizedServerTimeWaitInterval();
                }
   +            signal.wait(toWaitInterval);
   +            System.out.println("execution time: " + System.currentTimeMillis());
              }
    
              if (!alive) {
   ```
   
   @boglesby what do you think about this?


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

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