yossi reginiano created GEODE-5887:
--------------------------------------

             Summary: checkRegisteredKeys function consumes alot of CPU
                 Key: GEODE-5887
                 URL: https://issues.apache.org/jira/browse/GEODE-5887
             Project: Geode
          Issue Type: Improvement
            Reporter: yossi reginiano
             Fix For: 1.8.0


{color:#333333}in our many runs we have observed that the following function - 
AcceptorImpl:checkRegisteredKeys consumes about 6% of total CPU{color}

{color:#333333}this function go over all the registered connections to the JVM 
server , check if it was closed - and if so remove that connection from the 
registration{color}

{color:#333333}this is done continuously while we have any registered key{color}

{color:#333333}we have run the flow with update runSelectorLoop() function in 
which checkRegisteredKeys function is not being called continuously but rather 
every second , and observed about 7% reduction in the function CPU consumption 
- with no negative effect on the flow (was strictly verified in multiple 
runs){color}

{color:#333333}we suggest to insert the following change into 
AcceptorImpl::runSelectorLoop (of course *timeLimit* will come as a parameter 
from the properties file){color}

 

{color:#333333}try {
 *long initialTime = System.currentTimeMillis();*
 *long timeLimit = 1000;*
 
logger.info(LocalizedMessage.create(LocalizedStrings.AcceptorImpl_SELECTOR_ENABLED));
 while (this.selector.isOpen() && !Thread.currentThread().isInterrupted()) {
 {
 SystemFailure.checkFailure();
 // 
this.cache.getDistributedSystem().getCancelCriterion().checkCancelInProgress(null);
 if (this.cache.isClosed()) { // bug 38834
 break; // TODO should just ask cache's CancelCriterion
 }
 if (this.cache.getCancelCriterion().isCancelInProgress()) {
 break;
 }
 ServerConnection sc;
 *long delta = System.currentTimeMillis() - initialTime;*
 *if (delta >= timeLimit) {*
 *registeredKeys = checkRegisteredKeys(registeredKeys);*
 *initialTime = System.currentTimeMillis();*
 *}*
 if (registeredKeys == 0) {{color}

{color:#333333} {color}

{color:#333333}do note that due to many TO in this account - min-connections 
property was increased , which also causes checkRegisteredKeys to consume more 
CPU{color}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to