yiguolei commented on code in PR #38238: URL: https://github.com/apache/doris/pull/38238#discussion_r1689891089
########## be/src/runtime/workload_management/io_throttle.h: ########## @@ -0,0 +1,58 @@ +// 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. + +#pragma once + +#include <stdint.h> + +#include <atomic> +#include <condition_variable> +#include <mutex> + +namespace doris { + +class IOThrottle; + +struct IOThrottleCtx { + IOThrottle* io_throttle = nullptr; + int io_block_timeout; +}; + +class IOThrottle { +public: + IOThrottle() = default; + + ~IOThrottle() = default; + + bool acquire(int64_t block_timeout_ms); + + // non-block acquire + bool try_acquire(); + + void update_next_io_time(int64_t bytes); + + void set_io_bytes_per_second(int64_t read_bytes_per_second); + + int64_t get_io_bytes_per_second() { return _io_bytes_per_second; } + +private: + std::mutex _mutex; + std::condition_variable wait_condition; + int64_t _next_io_time_micros {0}; + std::atomic<int64_t> _io_bytes_per_second {10485760}; +}; Review Comment: 这个默认值不对,可能把他设置为一个默认invalid的值,这样他就不起作用了。万一fe 上同步的代码出了问题,io throttle 就出错了。 -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org