Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize PermissionChecker performance && adjust jsonrpc configuration #13034

Merged
merged 6 commits into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")})
skabashnyuk marked this conversation as resolved.
Show resolved Hide resolved
})
@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;
}
}
}