imay commented on a change in pull request #2710: use cgroups memory limit and cpu cores in container URL: https://github.com/apache/incubator-doris/pull/2710#discussion_r364203803
########## File path: be/src/util/cgroup_util.h ########## @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#ifndef DORIS_BE_SRC_UTIL_CGROUPING_UTIL_H +#define DORIS_BE_SRC_UTIL_CGROUPING_UTIL_H +#include <cstdint> +#include <string> +#include <utility> + +#include "common/status.h" +namespace doris { +class CGroupUtil { + public: + // Determines the CGroup memory limit from the current processes' cgroup. + // If the limit is more than INT64_MAX, INT64_MAX is returned (since that is + // effectively unlimited anyway). Does not take into account memory limits + // set on any ancestor CGroups. + static Status find_cgroup_mem_limit(int64_t* bytes); + + // Determines the CGroup cpu cores limit from the current processes' cgroup. + static Status find_cgroup_cpu_limit(float* cpu_count); + + // Returns a human-readable string with information about CGroups. + static std::string debug_string(); + + // detect if cgroup is enabled + static bool enable(); + + private: + static Status find_global_cgroup(const std::string& subsystem, std::string* path); Review comment: give some comments for this function? What does it do ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
