[ https://issues.apache.org/jira/browse/GEODE-5887?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691895#comment-16691895 ]
ASF subversion and git services commented on GEODE-5887: -------------------------------------------------------- Commit 8d992eb69f5727cabe62edcd229b52616552f340 in geode's branch refs/heads/develop from [~bschuchardt] [ https://gitbox.apache.org/repos/asf?p=geode.git;h=8d992eb ] Merge pull request #2810 from yossireg/develop checkRegisteredKeys function consumes alot of CPU - GEODE-5887 > 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 > Priority: Major > Labels: pull-request-available > Fix For: 1.8.0 > > Time Spent: 2h 40m > Remaining Estimate: 0h > > {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)