Skip to content

Commit

Permalink
Optimize PermissionChecker performance && adjust jsonrpc configuration (
Browse files Browse the repository at this point in the history
#13034)

* Optimize PermissionChecker performance && adjust jsonrpc configuration 
Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
  • Loading branch information
skabashnyuk authored Sep 11, 2019
1 parent 10c9c24 commit 00eaa1a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,20 +629,20 @@ che.server.secure_exposer.jwtproxy.memory_limit=128mb
# in case if pool size would be exceeded message execution will be rejected
che.core.jsonrpc.processor_max_pool_size=50
# Initial json processing pool. Minimum number of threads that used to process major JSON RPC messages.
che.core.jsonrpc.processor_core_pool_size=3
che.core.jsonrpc.processor_core_pool_size=5
# Configuration of queue used to process Json RPC messages.
# org.eclipse.che.commons.lang.execution.ExecutorServiceProvider contains more information about this parameter
che.core.jsonrpc.processor_queue_capacity=10000000
che.core.jsonrpc.processor_queue_capacity=100000

## Configuration of major "/websocket-minor" endpoint
# Maximum size of the JSON RPC processing pool
# in case if pool size would be exceeded message execution will be rejected
che.core.jsonrpc.minor_processor_max_pool_size=100
# Initial json processing pool. Minimum number of threads that used to process minor JSON RPC messages.
che.core.jsonrpc.minor_processor_core_pool_size=5
che.core.jsonrpc.minor_processor_core_pool_size=15
# Configuration of queue used to process Json RPC messages.
# org.eclipse.che.commons.lang.execution.ExecutorServiceProvider contains more information about this parameter
che.core.jsonrpc.minor_processor_queue_capacity=100
che.core.jsonrpc.minor_processor_queue_capacity=10000

## Port the the http server endpoint that would be exposed with Prometheus metrics
che.metrics.port=8087
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.QueryHint;
import javax.persistence.Table;
import org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl;
import org.eclipse.che.multiuser.api.permission.server.model.impl.AbstractPermissions;
Expand Down Expand Up @@ -54,7 +55,8 @@
"SELECT worker "
+ "FROM Worker worker "
+ "WHERE worker.userId = :userId "
+ "AND worker.workspaceId = :workspaceId ")
+ "AND worker.workspaceId = :workspaceId ",
hints = {@QueryHint(name = "eclipselink.query-results-cache", value = "true")})
})
@Table(name = "che_worker")
public class WorkerImpl extends AbstractPermissions implements Worker {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/
package org.eclipse.che.multiuser.permission.workspace.server.spi.tck;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.*;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
Expand Down Expand Up @@ -199,6 +199,7 @@ public void shouldReturnEmptyListIfWorkersWithSuchUserIdDoesNotFound() throws Ex
public void shouldRemoveWorker() throws Exception {
workerDao.removeWorker("ws1", "user1");
assertEquals(1, workerDao.getWorkersByUser("user1").size());
assertNull(notFoundToNull(() -> workerDao.getWorker("ws1", "user1")));
}

@Test(expectedExceptions = NullPointerException.class)
Expand Down Expand Up @@ -234,4 +235,12 @@ protected WorkerImpl doCreateInstance(
return new WorkerImpl(userId, instanceId, allowedActions);
}
}

private static <T> T notFoundToNull(Callable<T> action) throws Exception {
try {
return action.call();
} catch (NotFoundException x) {
return null;
}
}
}

0 comments on commit 00eaa1a

Please sign in to comment.