mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
9ccc483df6
major performance improvements in range GETs to avoid large read amplification when ranges are tiny and random ``` ------------------- Operation: GET Operations: 142014 -> 339421 Duration: 4m50s -> 4m56s * Average: +139.41% (+1177.3 MiB/s) throughput, +139.11% (+658.4) obj/s * Fastest: +125.24% (+1207.4 MiB/s) throughput, +132.32% (+612.9) obj/s * 50% Median: +139.06% (+1175.7 MiB/s) throughput, +133.46% (+660.9) obj/s * Slowest: +203.40% (+1267.9 MiB/s) throughput, +198.59% (+753.5) obj/s ``` TTFB from 10MiB BlockSize ``` * First Access TTFB: Avg: 81ms, Median: 61ms, Best: 20ms, Worst: 2.056s ``` TTFB from 1MiB BlockSize ``` * First Access TTFB: Avg: 22ms, Median: 21ms, Best: 8ms, Worst: 91ms ``` Full object reads however do see a slight change which won't be noticeable in real world, so not doing any comparisons TTFB still had improvements with full object reads with 1MiB ``` * First Access TTFB: Avg: 68ms, Median: 35ms, Best: 11ms, Worst: 1.16s ``` v/s TTFB with 10MiB ``` * First Access TTFB: Avg: 388ms, Median: 98ms, Best: 20ms, Worst: 4.156s ``` This change should affect all new uploads, previous uploads should continue to work with business as usual. But dramatic improvements can be seen with these changes.
157 lines
4.4 KiB
Bash
157 lines
4.4 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# MinIO Cloud Storage, (C) 2014-2018 MinIO, Inc.
|
|
#
|
|
# Licensed 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.
|
|
#
|
|
|
|
_init() {
|
|
|
|
shopt -s extglob
|
|
|
|
## Minimum required versions for build dependencies
|
|
GIT_VERSION="1.0"
|
|
GO_VERSION="1.16"
|
|
OSX_VERSION="10.8"
|
|
KNAME=$(uname -s)
|
|
ARCH=$(uname -m)
|
|
case "${KNAME}" in
|
|
SunOS )
|
|
ARCH=$(isainfo -k)
|
|
;;
|
|
esac
|
|
}
|
|
|
|
## FIXME:
|
|
## In OSX, 'readlink -f' option does not exist, hence
|
|
## we have our own readlink -f behavior here.
|
|
## Once OSX has the option, below function is good enough.
|
|
##
|
|
## readlink() {
|
|
## return /bin/readlink -f "$1"
|
|
## }
|
|
##
|
|
readlink() {
|
|
TARGET_FILE=$1
|
|
|
|
cd `dirname $TARGET_FILE`
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
|
|
# Iterate down a (possible) chain of symlinks
|
|
while [ -L "$TARGET_FILE" ]
|
|
do
|
|
TARGET_FILE=$(env readlink $TARGET_FILE)
|
|
cd `dirname $TARGET_FILE`
|
|
TARGET_FILE=`basename $TARGET_FILE`
|
|
done
|
|
|
|
# Compute the canonicalized name by finding the physical path
|
|
# for the directory we're in and appending the target file.
|
|
PHYS_DIR=`pwd -P`
|
|
RESULT=$PHYS_DIR/$TARGET_FILE
|
|
echo $RESULT
|
|
}
|
|
|
|
## FIXME:
|
|
## In OSX, 'sort -V' option does not exist, hence
|
|
## we have our own version compare function.
|
|
## Once OSX has the option, below function is good enough.
|
|
##
|
|
## check_minimum_version() {
|
|
## versions=($(echo -e "$1\n$2" | sort -V))
|
|
## return [ "$1" == "${versions[0]}" ]
|
|
## }
|
|
##
|
|
check_minimum_version() {
|
|
IFS='.' read -r -a varray1 <<< "$1"
|
|
IFS='.' read -r -a varray2 <<< "$2"
|
|
|
|
for i in "${!varray1[@]}"; do
|
|
if [[ ${varray1[i]} -lt ${varray2[i]} ]]; then
|
|
return 0
|
|
elif [[ ${varray1[i]} -gt ${varray2[i]} ]]; then
|
|
return 1
|
|
fi
|
|
done
|
|
|
|
return 0
|
|
}
|
|
|
|
assert_is_supported_arch() {
|
|
case "${ARCH}" in
|
|
x86_64 | amd64 | aarch64 | ppc64le | arm* | s390x )
|
|
return
|
|
;;
|
|
*)
|
|
echo "Arch '${ARCH}' is not supported. Supported Arch: [x86_64, amd64, aarch64, ppc64le, arm*, s390x]"
|
|
exit 1
|
|
esac
|
|
}
|
|
|
|
assert_is_supported_os() {
|
|
case "${KNAME}" in
|
|
Linux | FreeBSD | OpenBSD | NetBSD | DragonFly | SunOS )
|
|
return
|
|
;;
|
|
Darwin )
|
|
osx_host_version=$(env sw_vers -productVersion)
|
|
if ! check_minimum_version "${OSX_VERSION}" "${osx_host_version}"; then
|
|
echo "OSX version '${osx_host_version}' is not supported. Minimum supported version: ${OSX_VERSION}"
|
|
exit 1
|
|
fi
|
|
return
|
|
;;
|
|
*)
|
|
echo "OS '${KNAME}' is not supported. Supported OS: [Linux, FreeBSD, OpenBSD, NetBSD, Darwin, DragonFly]"
|
|
exit 1
|
|
esac
|
|
}
|
|
|
|
assert_check_golang_env() {
|
|
if ! which go >/dev/null 2>&1; then
|
|
echo "Cannot find go binary in your PATH configuration, please refer to Go installation document at https://golang.org/doc/install"
|
|
exit 1
|
|
fi
|
|
|
|
installed_go_version=$(go version | sed 's/^.* go\([0-9.]*\).*$/\1/')
|
|
if ! check_minimum_version "${GO_VERSION}" "${installed_go_version}"; then
|
|
echo "Go runtime version '${installed_go_version}' is unsupported. Minimum supported version: ${GO_VERSION} to compile."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
assert_check_deps() {
|
|
# support unusual Git versions such as: 2.7.4 (Apple Git-66)
|
|
installed_git_version=$(git version | perl -ne '$_ =~ m/git version (.*?)( |$)/; print "$1\n";')
|
|
if ! check_minimum_version "${GIT_VERSION}" "${installed_git_version}"; then
|
|
echo "Git version '${installed_git_version}' is not supported. Minimum supported version: ${GIT_VERSION}"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
## Check for supported arch
|
|
assert_is_supported_arch
|
|
|
|
## Check for supported os
|
|
assert_is_supported_os
|
|
|
|
## Check for Go environment
|
|
assert_check_golang_env
|
|
|
|
## Check for dependencies
|
|
assert_check_deps
|
|
}
|
|
|
|
_init && main "$@"
|