mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-06 07:32:38 +02:00
Compare commits
3 Commits
deploy-027
...
deploy-028
Author | SHA1 | Date | |
---|---|---|---|
|
1b80e282a7 | ||
|
a65d18f1d1 | ||
|
6e214293e5 |
@@ -125,8 +125,7 @@ public class JoobyService {
|
|||||||
// Set a cap on the number of worker threads, as Jooby's default value does not seem to consider
|
// Set a cap on the number of worker threads, as Jooby's default value does not seem to consider
|
||||||
// multi-tenant servers with high thread counts, and spins up an exorbitant number of threads in that
|
// multi-tenant servers with high thread counts, and spins up an exorbitant number of threads in that
|
||||||
// scenario
|
// scenario
|
||||||
options.setWorkerThreads(Math.min(128, options.getWorkerThreads()));
|
options.setWorkerThreads(Math.min(16, options.getWorkerThreads()));
|
||||||
|
|
||||||
|
|
||||||
jooby.setServerOptions(options);
|
jooby.setServerOptions(options);
|
||||||
|
|
||||||
|
@@ -2,6 +2,8 @@ package nu.marginalia.api.domains;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
import nu.marginalia.api.domains.model.DomainInformation;
|
||||||
|
import nu.marginalia.api.domains.model.SimilarDomain;
|
||||||
import nu.marginalia.service.client.GrpcChannelPoolFactory;
|
import nu.marginalia.service.client.GrpcChannelPoolFactory;
|
||||||
import nu.marginalia.service.client.GrpcSingleNodeChannelPool;
|
import nu.marginalia.service.client.GrpcSingleNodeChannelPool;
|
||||||
import nu.marginalia.service.discovery.property.ServiceKey;
|
import nu.marginalia.service.discovery.property.ServiceKey;
|
||||||
@@ -10,16 +12,19 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import nu.marginalia.api.domains.model.*;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DomainInfoClient {
|
public class DomainInfoClient {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DomainInfoClient.class);
|
private static final Logger logger = LoggerFactory.getLogger(DomainInfoClient.class);
|
||||||
|
|
||||||
private final GrpcSingleNodeChannelPool<DomainInfoAPIGrpc.DomainInfoAPIBlockingStub> channelPool;
|
private final GrpcSingleNodeChannelPool<DomainInfoAPIGrpc.DomainInfoAPIBlockingStub> channelPool;
|
||||||
private final ExecutorService executor = Executors.newWorkStealingPool(8);
|
|
||||||
|
|
||||||
|
private static final boolean useLoom = Boolean.getBoolean("system.experimentalUseLoom");
|
||||||
|
private static final ExecutorService executor = useLoom ? Executors.newVirtualThreadPerTaskExecutor() : Executors.newWorkStealingPool(8);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DomainInfoClient(GrpcChannelPoolFactory factory) {
|
public DomainInfoClient(GrpcChannelPoolFactory factory) {
|
||||||
|
@@ -24,7 +24,9 @@ import java.util.function.BiConsumer;
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FeedsClient {
|
public class FeedsClient {
|
||||||
private final ExecutorService executorService = Executors.newCachedThreadPool();
|
private static final boolean useLoom = Boolean.getBoolean("system.experimentalUseLoom");
|
||||||
|
private static final ExecutorService executorService = useLoom ? Executors.newVirtualThreadPerTaskExecutor() : Executors.newCachedThreadPool();
|
||||||
|
|
||||||
private final GrpcSingleNodeChannelPool<FeedApiGrpc.FeedApiBlockingStub> channelPool;
|
private final GrpcSingleNodeChannelPool<FeedApiGrpc.FeedApiBlockingStub> channelPool;
|
||||||
private final MqOutbox updateFeedsOutbox;
|
private final MqOutbox updateFeedsOutbox;
|
||||||
|
|
||||||
|
@@ -26,7 +26,9 @@ public class MathClient {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(MathClient.class);
|
private static final Logger logger = LoggerFactory.getLogger(MathClient.class);
|
||||||
|
|
||||||
private final GrpcSingleNodeChannelPool<MathApiGrpc.MathApiBlockingStub> channelPool;
|
private final GrpcSingleNodeChannelPool<MathApiGrpc.MathApiBlockingStub> channelPool;
|
||||||
private final ExecutorService executor = Executors.newWorkStealingPool(8);
|
|
||||||
|
private static final boolean useLoom = Boolean.getBoolean("system.experimentalUseLoom");
|
||||||
|
private static final ExecutorService executor = useLoom ? Executors.newVirtualThreadPerTaskExecutor() : Executors.newWorkStealingPool(8);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public MathClient(GrpcChannelPoolFactory factory) {
|
public MathClient(GrpcChannelPoolFactory factory) {
|
||||||
|
@@ -38,7 +38,9 @@ public class IndexClient {
|
|||||||
.help("Count of results filtered by NSFW tier")
|
.help("Count of results filtered by NSFW tier")
|
||||||
.register();
|
.register();
|
||||||
|
|
||||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
|
||||||
|
private static final boolean useLoom = Boolean.getBoolean("system.experimentalUseLoom");
|
||||||
|
private static final ExecutorService executor = useLoom ? Executors.newVirtualThreadPerTaskExecutor() : Executors.newCachedThreadPool();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public IndexClient(GrpcChannelPoolFactory channelPoolFactory,
|
public IndexClient(GrpcChannelPoolFactory channelPoolFactory,
|
||||||
|
@@ -63,12 +63,12 @@ public class BackoffStrategy {
|
|||||||
double backoffMinutes = baseInterval.toMinutes()
|
double backoffMinutes = baseInterval.toMinutes()
|
||||||
* Math.pow(multiplier, Math.clamp(backoffConsecutiveFailures, 1, 10));
|
* Math.pow(multiplier, Math.clamp(backoffConsecutiveFailures, 1, 10));
|
||||||
|
|
||||||
Duration newDuration = Duration.ofMinutes(Math.round(0.5+backoffMinutes));
|
var backoffVal = Math.round(0.5+backoffMinutes);
|
||||||
if (newDuration.compareTo(maxInterval) > 0) {
|
if (backoffVal > maxInterval.toMinutes()) {
|
||||||
return maxInterval;
|
return maxInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newDuration;
|
return Duration.ofMinutes(backoffVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Duration addJitter(Duration duration) {
|
private Duration addJitter(Duration duration) {
|
||||||
|
Reference in New Issue
Block a user