Make nginx/loki/mimir go fast

This commit is contained in:
Ilya K 2024-07-10 14:55:28 +03:00
parent f2c2bc5ab6
commit 9e7e6d42ab
3 changed files with 35 additions and 12 deletions

View file

@ -13,6 +13,12 @@
recommendedTlsSettings = lib.mkDefault true; recommendedTlsSettings = lib.mkDefault true;
recommendedProxySettings = lib.mkDefault true; recommendedProxySettings = lib.mkDefault true;
recommendedGzipSettings = lib.mkDefault true; recommendedGzipSettings = lib.mkDefault true;
eventsConfig = ''
worker_connections 8192;
'';
appendConfig = ''
worker_rlimit_nofile 16384;
'';
}; };
nix.gc = { nix.gc = {

View file

@ -88,12 +88,19 @@ in
systemd.services.loki.serviceConfig.EnvironmentFile = [ config.age.secrets.loki-environment.path ]; systemd.services.loki.serviceConfig.EnvironmentFile = [ config.age.secrets.loki-environment.path ];
services.nginx.virtualHosts."loki.forkos.org" = { services.nginx = {
enableACME = true; upstreams.loki = {
forceSSL = true; servers."127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}" = {};
locations."/loki/api/v1/push" = { extraConfig = "keepalive 16;";
proxyPass = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}"; };
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
virtualHosts."loki.forkos.org" = {
enableACME = true;
forceSSL = true;
locations."/loki/api/v1/push" = {
proxyPass = "http://loki";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
};
}; };
}; };

View file

@ -49,6 +49,9 @@ in
ingester.ring.replication_factor = 1; ingester.ring.replication_factor = 1;
distributor.instance_limits.max_ingestion_rate = 0; # unlimited
limits.ingestion_rate = 1000000; # can't set to unlimited :(
blocks_storage.backend = "s3"; blocks_storage.backend = "s3";
ruler_storage = { ruler_storage = {
backend = "local"; backend = "local";
@ -80,12 +83,19 @@ in
systemd.services.mimir.serviceConfig.EnvironmentFile = [ config.age.secrets.mimir-environment.path ]; systemd.services.mimir.serviceConfig.EnvironmentFile = [ config.age.secrets.mimir-environment.path ];
services.nginx.virtualHosts."mimir.forkos.org" = { services.nginx = {
enableACME = true; upstreams.mimir = {
forceSSL = true; servers."127.0.0.1:${toString mimirPort}" = {};
locations."/api/v1/push" = { extraConfig = "keepalive 16;";
proxyPass = "http://localhost:${toString mimirPort}"; };
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
virtualHosts."mimir.forkos.org" = {
enableACME = true;
forceSSL = true;
locations."/api/v1/push" = {
proxyPass = "http://mimir";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
};
}; };
}; };