Optimize PermissionChecker performance && adjust jsonrpc configuration (#13034)

* Optimize PermissionChecker performance && adjust jsonrpc configuration 
Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
7.20.x
Sergii Kabashniuk 2019-09-11 14:18:49 +02:00 committed by GitHub
parent 10c9c2476c
commit 00eaa1a10a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -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

View File

@ -22,6 +22,7 @@ import javax.persistence.JoinColumn;
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;
@ -54,7 +55,8 @@ import org.eclipse.che.multiuser.permission.workspace.server.model.Worker;
"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 {

View File

@ -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;
@ -199,6 +199,7 @@ public class WorkerDaoTest {
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)
@ -234,4 +235,12 @@ public class WorkerDaoTest {
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;
}
}
}