aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java
blob: 67938b36fd9bde8954f5fd1ff5a374873aae3e16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container;

import com.yahoo.config.provision.Flavor;
import com.yahoo.search.config.QrStartConfig;

/**
 * Tuning of qr-start config for a container service based on the node flavor of that node.
 *
 * @author balder
 */
public class NodeFlavorTuning implements QrStartConfig.Producer {

    private final Flavor flavor;

    NodeFlavorTuning(Flavor flavor) {
        this.flavor = flavor;
    }

    @Override
    public void getConfig(QrStartConfig.Builder builder) {
        builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(flavor.getMinCpuCores())));
    }

}