Commit bd886140 authored by Matija Obreza's avatar Matija Obreza

Fix: Scheduler and worker thread pool configuration

- Increased threadpool size and queue length
- Default db pool size 50
- Logging reduced
parent a025c927
......@@ -149,7 +149,7 @@ public class ElasticJPAListener {
} else {
Class<?> clazz = toReindex.getClass();
if (isIndexed(clazz)) {
LOG.debug("Reindexing {} {}", clazz.getName(), toReindex);
LOG.trace("Reindexing {} {}", clazz.getName(), toReindex);
if (toReindex instanceof BasicModel) {
BasicModel entity = (BasicModel) toReindex;
elasticReindexQueue.add(new ElasticReindex(clazz.getName(), entity.getId()));
......
......@@ -57,7 +57,7 @@ public class ElasticReindexProcessor {
/**
* Process queues.
*/
@Scheduled(fixedDelay = 2000)
@Scheduled(fixedDelay = 5100)
public void processQueues() {
if (LOG.isTraceEnabled()) {
LOG.trace("Scanning ES update queue");
......@@ -66,8 +66,8 @@ public class ElasticReindexProcessor {
List<ElasticReindex> forReindexing = new ArrayList<>();
Map<String, Set<Long>> buckets = Collections.synchronizedMap(new HashMap<String, Set<Long>>());
while (elasticReindexQueue.drainTo(forReindexing, 100) > 0) {
LOG.info("Remaining for reindex={}", elasticReindexQueue.size());
while (elasticReindexQueue.drainTo(forReindexing, 200) > 0) {
LOG.debug("Remaining for reindex={} handling={}", elasticReindexQueue.size(), forReindexing.size());
forReindexing.stream().forEach(er -> bucketize(buckets, er));
forReindexing.clear();
}
......
......@@ -29,7 +29,6 @@ import com.hazelcast.util.CollectionUtil;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
// TODO: Auto-generated Javadoc
/**
* Filters for {@link Accession}.
*/
......
......@@ -82,7 +82,7 @@ public class AccessionCounter implements InitializingBean, DisposableBean {
synchronized (instituteQueue) {
LOG.trace("Queue size {}, contains {} = {}", instituteQueue.size(), delay.getObj(), instituteQueue.contains(delay));
if (!instituteQueue.remove(delay)) {
LOG.debug("Element was not removed {}", delay.getObj());
LOG.trace("Element was not removed {}", delay.getObj());
}
instituteQueue.put(delay);
}
......
......@@ -34,7 +34,7 @@ public class SchedulerConfig {
final ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
pool.setCorePoolSize(4);
pool.setMaxPoolSize(8);
pool.setQueueCapacity(30);
pool.setQueueCapacity(100);
pool.setThreadNamePrefix("genesys-background-");
pool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
return pool;
......
......@@ -68,7 +68,7 @@ news.menu.abbreviate.length=22
db.pool.initialSize=1
db.pool.maxIdle=15
db.pool.maxActive=30
db.pool.maxActive=50
db.pool.maxIdleSeconds=30
# reCAPTCHA API: These are our keys for localhost
......
......@@ -6,6 +6,7 @@ hibernate.jdbc.fetch_size=25
hibernate.jdbc.batch_size=20
hibernate.order_updates=true
hibernate.order_inserts=true
hibernate.jdbc.batch_versioned_data=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=false
......
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