Check performance of multiple get calls over cluster

This commit is contained in:
mposolda 2016-03-07 12:21:19 +01:00 committed by Bill Burke
parent 6d0e5d6ad1
commit 6a48e00039
2 changed files with 29 additions and 0 deletions

View file

@ -103,6 +103,34 @@ public abstract class AbstractOfflineCacheCommand extends AbstractCommand {
} }
} }
// Just to check performance of multiple get calls. And comparing what's the change between the case when item is available locally or not.
public static class GetMultipleCommand extends AbstractOfflineCacheCommand {
@Override
public String getName() {
return "getMulti";
}
@Override
protected void doRunCacheCommand(KeycloakSession session, Cache<String, SessionEntity> cache) {
String id = getArg(0);
int count = getIntArg(1);
long start = System.currentTimeMillis();
for (int i=0 ; i<count ; i++) {
UserSessionEntity userSession = (UserSessionEntity) cache.get(id);
//printSession(id, userSession);
}
long took = System.currentTimeMillis() - start;
log.infof("Took %d milliseconds", took);
}
@Override
public String printUsage() {
return getName() + " <user-session-id> <count-of-gets>";
}
}
public static class RemoveCommand extends AbstractOfflineCacheCommand { public static class RemoveCommand extends AbstractOfflineCacheCommand {

View file

@ -45,6 +45,7 @@ public class TestsuiteCLI {
HelpCommand.class, HelpCommand.class,
AbstractOfflineCacheCommand.PutCommand.class, AbstractOfflineCacheCommand.PutCommand.class,
AbstractOfflineCacheCommand.GetCommand.class, AbstractOfflineCacheCommand.GetCommand.class,
AbstractOfflineCacheCommand.GetMultipleCommand.class,
AbstractOfflineCacheCommand.GetLocalCommand.class, AbstractOfflineCacheCommand.GetLocalCommand.class,
AbstractOfflineCacheCommand.RemoveCommand.class, AbstractOfflineCacheCommand.RemoveCommand.class,
AbstractOfflineCacheCommand.SizeCommand.class, AbstractOfflineCacheCommand.SizeCommand.class,