-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mount): Add client limit glibc malloc arenas
This change adds the `limitglibcmallocarenas` option to the client. This options allows to reduce the virtual memory used by the client, at the cost of possible performance drop for multi-threading (due to contention). The option is meant to be used in environments with limited RAM. Signed-off-by: Rolando Sánchez Ramos <[email protected]>
- Loading branch information
Showing
7 changed files
with
144 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
tests/test_suites/ShortSystemTests/test_limit_glibc_malloc_arenas_client.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
timeout_set 5 minutes | ||
|
||
CHUNKSERVERS=1 \ | ||
MOUNTS=2 \ | ||
MOUNT_EXTRA_CONFIG="sfscachemode=NEVER` | ||
`|cacheexpirationtime=10000` | ||
`|readcachemaxsizepercentage=1` | ||
`|sfschunkserverwavereadto=2000` | ||
`|sfsioretries=50` | ||
`|readaheadmaxwindowsize=5000` | ||
`|sfschunkservertotalreadto=8000" \ | ||
MOUNT_0_EXTRA_CONFIG="limitglibcmallocarenas=8" \ | ||
MOUNT_1_EXTRA_CONFIG="limitglibcmallocarenas=2" \ | ||
setup_local_empty_saunafs info | ||
|
||
num_jobs=18 | ||
five_percent_ram_mb=$(awk '/MemTotal/ {print int($2 / 1024 * 0.05)}' /proc/meminfo) | ||
size_per_job=$(echo "${five_percent_ram_mb} / ${num_jobs}" | bc) | ||
echo "five_percent_ram_mb: ${five_percent_ram_mb}, num_jobs: ${num_jobs}, size_per_job: ${size_per_job}" | ||
|
||
pgrep -fa sfsmount | ||
# Get the PIDs of the sfsmount processes | ||
pids=($(pgrep -fa sfsmount | awk '{print $1}')) | ||
|
||
# Access the PIDs separately | ||
pid1=${pids[0]} | ||
pid2=${pids[1]} | ||
|
||
echo "pids: ${pids[@]}" | ||
echo "pid1: $pid1, pid2: $pid2" | ||
|
||
function getVirtualMemoryForPid() { | ||
pid=${1} | ||
ps -o vsz= -p ${pid} | ||
} | ||
|
||
# Function to run fio commands and measure VSZ for a given mount point | ||
run_fio_and_measure_vsz() { | ||
# Prepare measure the average virtual memory usage during the fio read command | ||
local mount_point=$1 | ||
local pid=$2 | ||
local output_file="pidstat_output_$pid.txt" | ||
|
||
cd "$mount_point" | ||
|
||
fio --name=test_multiple_reads --directory=$mount_point --size=${size_per_job}M --rw=write --ioengine=libaio --group_reporting --numjobs=${num_jobs} --bs=1M --direct=1 --iodepth=1 > /dev/null 2>&1 | ||
|
||
# Run the fio read command in the background | ||
fio --name=test_multiple_reads --directory=$mount_point --size=${size_per_job}M --rw=read --ioengine=libaio --group_reporting --numjobs=${num_jobs} --bs=1M --direct=1 --iodepth=1 > /dev/null 2>&1 & | ||
|
||
# Store the fio process ID | ||
fio_pid=$(pgrep -f "fio --name=test_multiple_reads --directory=$mount_point --size=${size_per_job}M --rw=read") | ||
|
||
# Run pidstat in the background to monitor virtual memory usage | ||
sleep 1 | ||
virtualMemory=$(getVirtualMemoryForPid $pid) | ||
|
||
# Wait for the fio command to complete | ||
wait $fio_pid | ||
|
||
# Calculate the average virtual memory usage | ||
echo $virtualMemory | ||
} | ||
|
||
# Run the fio commands and measure VSZ for both mount points | ||
echo "Running fio commands and measuring VSZ for both mount points" | ||
avg_vsz_mount0=$(run_fio_and_measure_vsz "${info[mount0]}" $pid1) | ||
avg_vsz_mount1=$(run_fio_and_measure_vsz "${info[mount1]}" $pid2) | ||
|
||
# Print the average VSZ values | ||
echo "Average VSZ for ${info[mount0]}: ${avg_vsz_mount0}" | ||
echo "Average VSZ for ${info[mount1]}: ${avg_vsz_mount1}" | ||
|
||
# Compare the average VSZ values in one line | ||
result=0 | ||
if (( $(echo "$avg_vsz_mount1 < $avg_vsz_mount0") )); then | ||
result=1 | ||
else | ||
result=0 | ||
fi | ||
|
||
assert_equals "1" "$result" |