risingwave_common/config/frontend.rs
1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use super::*;
16
17/// The section [`frontend`] in `risingwave.toml`.
18#[derive(Clone, Debug, Serialize, Deserialize, DefaultFromSerde, ConfigDoc)]
19pub struct FrontendConfig {
20 /// Total memory constraints for running queries.
21 #[serde(default = "default::frontend::max_total_query_size_bytes")]
22 pub max_total_query_size_bytes: u64,
23
24 /// A query of size under this threshold will never be rejected due to memory constraints.
25 #[serde(default = "default::frontend::min_single_query_size_bytes")]
26 pub min_single_query_size_bytes: u64,
27
28 /// A query of size exceeding this threshold will always be rejected due to memory constraints.
29 #[serde(default = "default::frontend::max_single_query_size_bytes")]
30 pub max_single_query_size_bytes: u64,
31}
32
33pub mod default {
34
35 pub mod frontend {
36 pub fn max_total_query_size_bytes() -> u64 {
37 1024 * 1024 * 1024
38 }
39
40 pub fn min_single_query_size_bytes() -> u64 {
41 1024 * 1024
42 }
43
44 pub fn max_single_query_size_bytes() -> u64 {
45 1024 * 1024 * 1024
46 }
47 }
48}