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,14 +88,21 @@ 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 = {
upstreams.loki = {
servers."127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}" = {};
extraConfig = "keepalive 16;";
};
virtualHosts."loki.forkos.org" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/loki/api/v1/push" = { locations."/loki/api/v1/push" = {
proxyPass = "http://localhost:${toString config.services.loki.configuration.server.http_listen_port}"; proxyPass = "http://loki";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path; basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
}; };
}; };
};
bagel.monitoring.grafana-agent.exporters.loki.port = 9090; bagel.monitoring.grafana-agent.exporters.loki.port = 9090;
}; };

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,14 +83,21 @@ 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 = {
upstreams.mimir = {
servers."127.0.0.1:${toString mimirPort}" = {};
extraConfig = "keepalive 16;";
};
virtualHosts."mimir.forkos.org" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/api/v1/push" = { locations."/api/v1/push" = {
proxyPass = "http://localhost:${toString mimirPort}"; proxyPass = "http://mimir";
basicAuthFile = config.age.secrets.metrics-push-htpasswd.path; basicAuthFile = config.age.secrets.metrics-push-htpasswd.path;
}; };
}; };
};
bagel.monitoring.grafana-agent.exporters.mimir.port = 9009; bagel.monitoring.grafana-agent.exporters.mimir.port = 9009;
}; };