Commit 360d4111 authored by Matija Obreza's avatar Matija Obreza
Browse files

Hazelcast cache config

parent 91d3c626
......@@ -175,7 +175,7 @@ public class GenesysFilterServiceImpl implements GenesysFilterService {
LOG.debug("Total count: " + totalCount);
if (totalCount > 0 && pageable.getPageNumber() * pageable.getPageSize() <= totalCount) {
final List<Long> results = this.jdbcTemplate.queryForList(directQuery.getQuery("distinct a.id"), directQuery.getParameters(), Long.class);
final List<Long> results = this.jdbcTemplate.queryForList(directQuery.getQuery("a.id"), directQuery.getParameters(), Long.class);
LOG.debug("Getting accessions " + results.size());
if (results.size() == 0) {
......
......@@ -76,7 +76,7 @@ public class HazelcastConfigAWS extends HazelcastConfig {
System.out.println("Hazelcast: Using public address " + hazelPublicAddress);
network.setPublicAddress(hazelPublicAddress);
}
if (StringUtils.isNotBlank(hazelInterfaces)) {
for (String hazelInterface : hazelInterfaces.split(",")) {
System.out.println("Hazelcast: Adding single interface " + hazelInterface);
......@@ -100,10 +100,12 @@ public class HazelcastConfigAWS extends HazelcastConfig {
defaultMapConfig.setTimeToLiveSeconds(defaultTimeToLiveSeconds);
defaultMapConfig.setMaxIdleSeconds(defaultMaxIdleSeconds);
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(defaultCacheSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(defaultMapConfig);
MapConfig tileserverMapConfig = new MapConfig();
......@@ -111,12 +113,27 @@ public class HazelcastConfigAWS extends HazelcastConfig {
tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL);
tileserverMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
tileserverMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
MaxSizeConfig tileserverMaxSizeConfig = new MaxSizeConfig();
tileserverMaxSizeConfig.setSize(tileserverMaxSize);
tileserverMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
tileserverMapConfig.setMaxSizeConfig(tileserverMaxSizeConfig);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
tileserverMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(tileserverMapConfig);
MapConfig jettySessionsMapConfig = new MapConfig();
jettySessionsMapConfig.setName("jetty-sessions");
jettySessionsMapConfig.setTimeToLiveSeconds(60*60*24); // 1 day
jettySessionsMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
jettySessionsMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
jettySessionsMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(jettySessionsMapConfig);
ExecutorConfig execConfig = new ExecutorConfig();
execConfig.setName("hazel-exec");
execConfig.setPoolSize(4);
......
......@@ -72,23 +72,40 @@ public class HazelcastConfigDev extends HazelcastConfig {
defaultMapConfig.setTimeToLiveSeconds(defaultTimeToLiveSeconds);
defaultMapConfig.setMaxIdleSeconds(defaultMaxIdleSeconds);
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(defaultCacheSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(defaultMapConfig);
MapConfig tileserverMapConfig = new MapConfig();
tileserverMapConfig.setName("tileserver");
tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL);
tileserverMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
tileserverMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
MaxSizeConfig tileserverMaxSizeConfig = new MaxSizeConfig();
tileserverMaxSizeConfig.setSize(tileserverMaxSize);
tileserverMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
tileserverMapConfig.setMaxSizeConfig(tileserverMaxSizeConfig);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
tileserverMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(tileserverMapConfig);
MapConfig jettySessionsMapConfig = new MapConfig();
jettySessionsMapConfig.setName("jetty-sessions");
jettySessionsMapConfig.setTimeToLiveSeconds(30);
jettySessionsMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
jettySessionsMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
jettySessionsMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(jettySessionsMapConfig);
ExecutorConfig execConfig = new ExecutorConfig();
execConfig.setName("hazel-exec");
execConfig.setPoolSize(4);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment