Skip to content

Fix LB timeout in QueryServer #893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/src/handlers/http/modal/query_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use actix_web::web::ServiceConfig;
use actix_web::{App, HttpServer};
use async_trait::async_trait;
use std::sync::Arc;
use std::time::Duration;

use crate::option::CONFIG;

Expand Down Expand Up @@ -74,8 +75,10 @@ impl ParseableServer for QueryServer {
.wrap(cross_origin_config())
};

let keep_alive_timeout = 120;

// concurrent workers equal to number of cores on the cpu
let http_server = HttpServer::new(create_app_fn).workers(num_cpus::get());
let http_server = HttpServer::new(create_app_fn).workers(num_cpus::get()).keep_alive(Duration::from_secs(keep_alive_timeout));
if let Some(config) = ssl {
http_server
.bind_rustls_0_22(&CONFIG.parseable.address, config)?
Expand Down
12 changes: 10 additions & 2 deletions server/src/handlers/http/modal/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ use crate::storage;
use crate::sync;
use crate::users::dashboards::DASHBOARDS;
use crate::users::filters::FILTERS;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;

use actix_web::web::resource;
use actix_web::web::{resource, Data};
use actix_web::Resource;
use actix_web::Scope;
use actix_web::{web, App, HttpServer};
use actix_web_prometheus::PrometheusMetrics;
use actix_web_static_files::ResourceFiles;
use async_trait::async_trait;
use tokio::sync::Mutex;

use crate::{
handlers::http::{
Expand Down Expand Up @@ -83,7 +86,10 @@ impl ParseableServer for Server {
};

let create_app_fn = move || {
let query_map: query::QueryMap = Arc::new(Mutex::new(HashMap::new()));

App::new()
.app_data(Data::new(query_map))
.wrap(prometheus.clone())
.configure(|cfg| Server::configure_routes(cfg, oidc_client.clone()))
.wrap(actix_web::middleware::Logger::default())
Expand All @@ -96,8 +102,10 @@ impl ParseableServer for Server {
&CONFIG.parseable.tls_key_path,
)?;

let keep_alive_timeout = 120;

// concurrent workers equal to number of cores on the cpu
let http_server = HttpServer::new(create_app_fn).workers(num_cpus::get());
let http_server = HttpServer::new(create_app_fn).workers(num_cpus::get()).keep_alive(Duration::from_secs(keep_alive_timeout));
if let Some(config) = ssl {
http_server
.bind_rustls_0_22(&CONFIG.parseable.address, config)?
Expand Down
Loading
Loading