Why is different benchmarks of HD/SD between hdparm and dd tool? - benchmarking

I see some tools to help benchmark HD/SD speed (read and write).
hdparm and dd
I did some benchmarks with these tools:
Input: buffered size = 932 MB
Read speed with dd: 536 MB/s
Write speed with dd: 492 MB/s
Read speed with hdparm: 310.51 MB/s
uncaching:
root#tech_expert:/home/tech_expert# hdparm -W0 /dev/sda5
/dev/sda5:
setting drive write-caching to 0 (off)
write-caching = 0 (off)
read speed with hdparm (caches dropped)
root#tech_expert:/home/tech_expert# sync; echo 3 > /proc/sys/vm/drop_caches
root#tech_expert:/home/tech_expert# time sh -c "sudo hdparm -t /dev/sda5 && sync"
/dev/sda5:
Timing buffered disk reads: 932 MB in 3.00 seconds = 310.51 MB/sec
real 0m6.229s
user 0m0.032s
sys 0m0.798s
write speed with dd (caches dropped)
root#tech_expert:/home/tech_expert# sync; echo 3 > /proc/sys/vm/drop_caches
root#tech_expert:/home/tech_expert# time sh -c "dd if=/dev/zero of=test bs=8k count=113800 && sync"; rm -f test
113800+0 records in
113800+0 records out
932249600 bytes (932 MB, 889 MiB) copied, 1.89512 s, 492 MB/s
real 0m2.686s
user 0m0.018s
sys 0m0.904s
read speed with hdparm (caches used)
root#tech_expert:/home/tech_expert# time sh -c "sudo hdparm -T /dev/sda5 && sync"
/dev/sda5:
Timing cached reads: 23848 MB in 1.99 seconds = 11964.42 MB/sec
real 0m7.127s
user 0m0.260s
sys 0m1.781s
read speed with dd (caches dropped)
Keep the "test" file and execute below command:
root#tech_expert:/home/tech_expert# time sh -c "dd if=test of=/dev/null bs=8k count=113800 && sync"
113800+0 records in
113800+0 records out
932249600 bytes (932 MB, 889 MiB) copied, 1.73958 s, 536 MB/s
real 0m1.775s
user 0m0.098s
sys 0m0.732s
read speed with dd (caches used)
root#tech_expert:/home/tech_expert# time sh -c "dd if=test of=/dev/null bs=8k count=113800 && sync"
113800+0 records in
113800+0 records out
932249600 bytes (932 MB, 889 MiB) copied, 0.198455 s, 4.7 GB/s
real 0m0.230s
user 0m0.026s
sys 0m0.175s
There were big differences between 02 tools.
I don't know I should believe in which result is more trusty?

Related

Faster drop-in replacement for bash `cut` for specific application

I have a very large tab separated file. The tab separated file is binary and will be streamed by the tool samtools (which is very fast and not the bottleneck). Now I want to output only the content up to the first tab.
In my current piped command cut is the bottleneck:
samtools view -# 15 -F 0x100 file.bam | cut -f 1 | pigz > out.gz
I tried using awk '{print $1}'. This is not sufficiently faster I also tried using parallelin combination withcut` but this also does not increase the speed much.
I guess it would be better to have a tool which just outputs the string until first tab and then completely skips the entire line.
Do you have a suggestion for a tool which is faster for my purpose? Ideally, one would write a small C program I guess but my C is a bit rusty so would take too long for me.
You are interested in a small C program that just outputs lines from stdin until first tab.
In C you can do this easily with something like this:
#include <stdio.h>
#include <string.h>
#define MAX_LINE_LENGTH 1024
int main(void) {
char buf[MAX_LINE_LENGTH];
while(fgets(buf, sizeof(buf), stdin) != NULL) {
buf[strcspn(buf, "\n\t")] = '\0';
fputs(buf, stdout);
fputc('\n', stdout);
}
return 0;
}
It simply reads lines with fgets from stdin. The string is terminated with a NUL byte at the first tab \t. The same applies if there is a \n to have no extra line feeds in the output, just in case there is no tab on an input line.
Whether this is much faster in your use case I cannot say, but it should at least provide a starting point for trying out your idea.
GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)
You might give a try other implementation of AWK, according to test done in 2009¹ Don’t MAWK AWK – the fastest and most elegant big data munging language! nawk was found faster than gawk and mawk was found faster than nawk. You would need to run test with your data to find if using other implementation give noticeable boost.
¹so versions available in 2022 might give different result
In the question OP has mentioned that awk '{print $1}' is not sufficiently faster than cut; in my testing I'm seeing awk running about twice as fast as cut, so not sure how OP is using awk ... or if I'm missing something (basic) with my testing ...
OP has mentioned a 'large' tab-delimited file with up to 400 characters per line; we'll simulate this with the following code that generates a ~400MB file:
$ cat sam_out.awk
awk '
BEGIN { OFS="\t"; x="1234567890"
for (i=1;i<=40;i++) filler=filler x
for (i=1;i<=1000000;i++) print x,filler
}'
$ . ./sam_out.awk | wc
1000000 2000000 412000000
Test calls:
$ cat sam_tests.sh
echo "######### pipe to cut"
time . ./sam_out.awk | cut -f1 - > /dev/null
echo "######### pipe to awk"
time . ./sam_out.awk | awk '{print $1}' > /dev/null
echo "######### process-sub to cut"
time cut -f1 <(. ./sam_out.awk) > /dev/null
echo "######### process-sub to awk"
time awk '{print $1}' <(. ./sam_out.awk) > /dev/null
NOTE: also ran all 4 tests with output written to 4 distinct output files; diff of the 4 output files showed all were the same (wc: 1000000 1000000 11000000; head -1: 1234567890)
Results of running the tests:
######### pipe to cut
real 0m1.177s
user 0m0.205s
sys 0m1.454s
######### pipe to awk
real 0m0.582s
user 0m0.166s
sys 0m0.759s
######### process-sub to cut
real 0m1.265s
user 0m0.351s
sys 0m1.746s
######### process-sub to awk
real 0m0.655s
user 0m0.097s
sys 0m0.968s
NOTES:
test system: Ubuntu 10.04, cut (GNU coreutils 8.30), awk (GNU Awk 5.0.1)
earlier version of this answer showed awk running 14x-15x times faster than cut; that system: cygwin 3.3.5, cut (GNU coreutils 8.26), awk (GNU Awk 5.1.1)
You might consider process-substitutions instead of a pipeline.
$ < <( < <(samtools view -# 15 -F 0x100 file.bam) cut -f1 ) pigz
Note: I'm using process substitution to generate stdin and avoid using another FIFO. This seems to be much faster.
I've written a simple test script sam_test.sh that generates some output:
#!/usr/bin/env bash
echo {1..10000} | awk 'BEGIN{OFS="\t"}{$1=$1;for(i=1;i<=1000;++i) print i,$0}'
and compared the output of the following commands:
$ ./sam_test.sh | cut -f1 | awk '!(FNR%3)'
$ < <(./sam_test.sh) cut -f1 | awk '!(FNR%3)'
$ < <( < <(./sam_test.sh) cut -f1 ) awk '!(FNR%3)'
The later of the three cases is in 'runtime' significantly faster. Using strace -c , we can see that each pipeline adds a significant amount of wait4 syscalls. The final version is then also significantly faster (factor 700 in the above case).
Output of test case (short):
$ cat ./sam_test_full_pipe.sh
#!/usr/bin/env bash
./sam_test.sh | cut -f1 - | awk '!(FNR%3)' -
$ strace -c ./sam_test_full_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
99.22 0.643249 160812 4 1 wait4
0.30 0.001951 5 334 294 openat
0.21 0.001331 5 266 230 stat
0.04 0.000290 20 14 12 execve
<snip>
------ ----------- ----------- --------- --------- ----------------
100.00 0.648287 728 890 549 total
$ cat ./sam_test_one_pipe.sh
#!/usr/bin/env bash
< <(./sam_test.sh) cut -f1 - | awk '!(FNR%3)' -
$ strace -c ./sam_test_one_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
98.72 0.256664 85554 3 1 wait4
0.45 0.001181 3 334 294 openat
0.29 0.000757 2 266 230 stat
<snip>
------ ----------- ----------- --------- --------- ----------------
100.00 0.259989 295 881 547 total
$ cat ./sam_test_no_pipe.sh
#!/usr/bin/env bash
< <(< <(./sam_test.sh) cut -f1 - ) awk '!(FNR%3)' -
$ strace -c ./sam_test_no_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
39.43 0.002863 1431 2 1 wait4
19.68 0.001429 4 334 294 openat
14.87 0.001080 3 285 242 stat
10.00 0.000726 51 14 12 execve
<snip>
------ ----------- ----------- --------- --------- ----------------
100.00 0.007261 7 909 557 total
Output of test case (full):
$ cat ./sam_test_full_pipe.sh
#!/usr/bin/env bash
./sam_test.sh | cut -f1 - | awk '!(FNR%3)' -
$ strace -c ./sam_test_full_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
99.22 0.643249 160812 4 1 wait4
0.30 0.001951 5 334 294 openat
0.21 0.001331 5 266 230 stat
0.04 0.000290 20 14 12 execve
0.04 0.000276 6 42 mmap
0.04 0.000229 76 3 clone
0.03 0.000178 3 49 4 close
0.02 0.000146 3 39 fstat
0.02 0.000109 9 12 mprotect
0.01 0.000080 5 16 read
0.01 0.000053 2 18 rt_sigprocmask
0.01 0.000052 3 16 rt_sigaction
0.01 0.000038 3 10 brk
0.01 0.000036 18 2 munmap
0.01 0.000034 5 6 2 access
0.00 0.000029 3 8 1 fcntl
0.00 0.000024 3 7 lseek
0.00 0.000019 4 4 3 ioctl
0.00 0.000019 9 2 pipe
0.00 0.000018 3 5 getuid
0.00 0.000018 3 5 getgid
0.00 0.000018 3 5 getegid
0.00 0.000017 3 5 geteuid
0.00 0.000013 4 3 dup2
0.00 0.000013 13 1 faccessat
0.00 0.000009 2 4 2 arch_prctl
0.00 0.000008 4 2 getpid
0.00 0.000008 4 2 prlimit64
0.00 0.000005 5 1 sysinfo
0.00 0.000004 4 1 write
0.00 0.000004 4 1 uname
0.00 0.000004 4 1 getppid
0.00 0.000003 3 1 getpgrp
0.00 0.000002 2 1 rt_sigreturn
------ ----------- ----------- --------- --------- ----------------
100.00 0.648287 728 890 549 total
$ cat ./sam_test_one_pipe.sh
#!/usr/bin/env bash
< <(./sam_test.sh) cut -f1 - | awk '!(FNR%3)' -
$ strace -c ./sam_test_one_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
98.72 0.256664 85554 3 1 wait4
0.45 0.001181 3 334 294 openat
0.29 0.000757 2 266 230 stat
0.11 0.000281 20 14 12 execve
0.08 0.000220 5 42 mmap
0.06 0.000159 79 2 clone
0.05 0.000138 3 45 2 close
0.05 0.000125 3 39 fstat
0.03 0.000083 6 12 mprotect
0.02 0.000060 3 16 read
0.02 0.000054 3 16 rt_sigaction
0.02 0.000042 2 16 rt_sigprocmask
0.01 0.000038 6 6 2 access
0.01 0.000035 17 2 munmap
0.01 0.000027 2 10 brk
0.01 0.000019 3 5 getuid
0.01 0.000018 3 5 geteuid
0.01 0.000017 3 5 getgid
0.01 0.000017 3 5 getegid
0.00 0.000010 1 7 lseek
0.00 0.000009 2 4 3 ioctl
0.00 0.000008 4 2 getpid
0.00 0.000007 1 4 2 arch_prctl
0.00 0.000005 5 1 sysinfo
0.00 0.000004 4 1 uname
0.00 0.000003 3 1 getppid
0.00 0.000003 3 1 getpgrp
0.00 0.000003 1 2 prlimit64
0.00 0.000002 2 1 rt_sigreturn
0.00 0.000000 0 1 write
0.00 0.000000 0 1 pipe
0.00 0.000000 0 3 dup2
0.00 0.000000 0 8 1 fcntl
0.00 0.000000 0 1 faccessat
------ ----------- ----------- --------- --------- ----------------
100.00 0.259989 295 881 547 total
$ cat ./sam_test_no_pipe.sh
#!/usr/bin/env bash
< <(< <(./sam_test.sh) cut -f1 - ) awk '!(FNR%3)' -
$ strace -c ./sam_test_no_pipe.sh > /dev/null
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
39.43 0.002863 1431 2 1 wait4
19.68 0.001429 4 334 294 openat
14.87 0.001080 3 285 242 stat
10.00 0.000726 51 14 12 execve
2.67 0.000194 4 42 mmap
1.83 0.000133 3 39 fstat
1.67 0.000121 121 1 clone
1.58 0.000115 2 41 close
0.88 0.000064 6 10 2 access
0.87 0.000063 5 12 mprotect
0.73 0.000053 3 16 rt_sigaction
0.70 0.000051 4 12 rt_sigprocmask
0.66 0.000048 3 16 read
0.48 0.000035 3 10 brk
0.48 0.000035 3 9 getuid
0.44 0.000032 16 2 munmap
0.41 0.000030 3 8 1 fcntl
0.41 0.000030 3 9 geteuid
0.40 0.000029 3 9 getegid
0.34 0.000025 2 9 getgid
0.22 0.000016 5 3 dup2
0.21 0.000015 3 4 3 ioctl
0.19 0.000014 2 7 lseek
0.18 0.000013 13 1 faccessat
0.12 0.000009 2 4 2 arch_prctl
0.11 0.000008 4 2 prlimit64
0.08 0.000006 3 2 getpid
0.06 0.000004 4 1 write
0.06 0.000004 4 1 rt_sigreturn
0.06 0.000004 4 1 uname
0.06 0.000004 4 1 sysinfo
0.06 0.000004 4 1 getppid
0.06 0.000004 4 1 getpgrp
------ ----------- ----------- --------- --------- ----------------
100.00 0.007261 7 909 557 total
In the end I hacked a small C program which directly filters the BAM file and also writes to a gzip -- with a lot of help of the htslib developers (which is the basis for samtools).
So piping is not needed any more. This solution is about 3-4 times faster than the solution with the C code above (from Stephan).
See here:
https://github.com/samtools/samtools/issues/1672
if you just need first field why not just
{m,n,g}awk NF=1 FS='\t'
In terms of performance, I don't have a tab file handy but i do have 12.5mn rows 1.85 GB .txt with plenty of multi-byte UTF-8 in it that's "=" separated :
rows = 12,494,275. | ascii+utf8 chars = 1,285,316,715. | bytes = 1,983,544,693.
- 4.44s mawk 2
- 4.95s mawk 1
- 10.48s gawk 5.1.1
- 40.07s nawk
Why some enjoy pushing for the slow awks is beyond me.
=
in0: 35.8MiB 0:00:00 [ 357MiB/s] [ 357MiB/s] [> ] 1% ETA 0:00:00
out9: 119MiB 0:00:04 [27.0MiB/s] [27.0MiB/s] [ <=> ]
in0: 1.85GiB 0:00:04 [ 428MiB/s] [ 428MiB/s] [======>] 100%
( pvE 0.1 in0 < "${m3t}" | mawk2 NF=1 FS==; )
4.34s user 0.45s system 107% cpu 4.439 total
1 52888940993baac8299b49ee2f5bdee7 stdin
=
in0: 1.85GiB 0:00:04 [ 384MiB/s] [ 384MiB/s] [=====>] 100%
out9: 119MiB 0:00:04 [24.2MiB/s] [24.2MiB/s] [ <=>]
( pvE 0.1 in0 < "${m3t}" | mawk NF=1 FS==; )
4.83s user 0.47s system 107% cpu 4.936 total
1 52888940993baac8299b49ee2f5bdee7 stdin
=
in0: 1.85GiB 0:00:10 [ 180MiB/s] [ 180MiB/s] [ ==>] 100%
out9: 119MiB 0:00:10 [11.4MiB/s] [11.4MiB/s] [ <=>]
( pvE 0.1 in0 < "${m3t}" | gawk NF=1 FS==; )
10.36s user 0.56s system 104% cpu 10.476 total
1 52888940993baac8299b49ee2f5bdee7 stdin
=
in0: 4.25MiB 0:00:00 [42.2MiB/s] [42.2MiB/s] [> ] 0% ETA 0:00:00
out9: 119MiB 0:00:40 [2.98MiB/s] [2.98MiB/s] [<=> ]
in0: 1.85GiB 0:00:40 [47.2MiB/s] [47.2MiB/s] [=====>] 100%
( pvE 0.1 in0 < "${m3t}" | nawk NF=1 FS==; )
39.79s user 0.88s system 101% cpu 40.068 total
1 52888940993baac8299b49ee2f5bdee7 stdin
But these pale compared to using the right FS to collect everything away :
barely 1.95 secs
( pvE 0.1 in0 < "${m3t}" | mawk2 NF-- FS='=.*$'; )
1.83s user 0.42s system 115% cpu 1.951 total
1 52888940993baac8299b49ee2f5bdee7 stdin
By comparison, even gnu-cut that is purely C-code binary is slower :
( pvE 0.1 in0 < "${m3t}" | gcut -d= -f 1; )
2.53s user 0.50s system 113% cpu 2.674 total
1 52888940993baac8299b49ee2f5bdee7 stdin
You can save a tiny bit (1.772 secs) more using a more verbose approach :
( pvE 0.1 in0 < "${m3t}" | mawk2 '{ print $1 }' FS='=.*$'; )
1.64s user 0.42s system 116% cpu 1.772 total
1 52888940993baac8299b49ee2f5bdee7 stdin
Unfortunately, complex FS really isn't gawk's forte, even after you give it a helping boost with the byte-level flag :
( pvE 0.1 in0 < "${m3t}" | gawk -F'=.+$' -be NF--; )
20.23s user 0.59s system 102% cpu 20.383 total
52888940993baac8299b49ee2f5bdee7 stdin

how long takes mariadb memory to stabilize?

5.13
We made tweaks on my.cnf according to mysql tuner, and tuning primer,
but i can't really figure out when the memory will be stabilize usage of mariadb.
Here mysql tuner result -
------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 5d 8h 19m 28s (226M q [491.299 qps], 1M conn, TX: 4653G, RX: 49G)
[--] Reads / Writes: 95% / 5%
[--] Binary logging is disabled
[--] Physical Memory : 125.3G
[--] Max MySQL memory : 67.1G
[--] Other process memory: 0B
[--] Total buffers: 15.4G global + 264.8M per thread (200 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 34.3G (27.34% of installed RAM)
[OK] Maximum possible memory usage: 67.1G (53.54% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (78/226M)
[OK] Highest usage of available connections: 36% (73/200)
[OK] Aborted connections: 0.02% (447/1823123)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 0% (4K temp sorts / 56M sorts)
[!!] Joins performed without indexes: 815533
[!!] Temporary tables created on disk: 87% (26M on disk / 30M total)
[OK] Thread cache hit rate: 99% (73 created / 1M connections)
[OK] Table cache hit rate: 99% (286M hits / 287M requests)
[OK] table_definition_cache(37000) is upper than number of tables(36204)
[OK] Open file limit used: 69% (51K/74K)
[OK] Table locks acquired immediately: 99% (170M immediate / 170M locks)
Here tuning primer -
WORKER THREADS
Current thread_cache_size = 200
Current threads_cached = 72
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 200
Current threads_connected = 1
Historic max_used_connections = 73
The number of used connections is 36% of the configured maximum.
Your max_connections variable seems to be fine.
INNODB STATUS
Current InnoDB index space = 1.46 G
Current InnoDB data space = 10.79 G
Current InnoDB buffer pool free = 24 %
Current innodb_buffer_pool_size = 15.00 G
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory
MEMORY USAGE
Max Memory Ever Allocated : 15.76 G
Configured Max Per-thread Buffers : 1.71 G
Configured Max Global Buffers : 15.14 G
Configured Max Memory Limit : 16.85 G
Physical Memory : 125.34 G
Max memory limit seem to be within acceptable norms
Here a sample of resources from top since start up until 5 days and 8 hours uptime of mariadb -
mysql 20 0 21.4g 4.1g 24576 S 4.7 3.3 0:08.90 mariadbd
mysql 20 0 21.4g 4.8g 25728 S 4.7 3.8 2:13.62 mariadbd
mysql 20 0 25.9g 8.7g 26480 S 15.0 6.9 56:52.91 mariadbd
mysql 20 0 26.2g 8.8g 26480 S 3.7 7.0 58:37.38 mariadbd
mysql 20 0 26.7g 9.3g 26480 S 10.6 7.4 66:38.53 mariadbd
mysql 20 0 26.7g 9.3g 26480 S 6.3 7.4 76:34.20 mariadbd
mysql 20 0 26.9g 9.6g 26480 S 10.0 7.7 80:31.37 mariadbd
mysql 20 0 26.9g 9.8g 26480 S 10.3 7.8 95:36.03 mariadbd
mysql 20 0 27.4g 10.2g 26480 S 8.0 8.1 96:28.67 mariadbd
mysql 20 0 27.7g 12.4g 26496 S 2.7 9.9 127:20.78 mariadbd
mysql 20 0 27.7g 15.0g 26496 S 11.3 12.0 129:35.15 mariadbd
mysql 20 0 27.7g 16.3g 26492 S 4.7 13.0 130:34.33 mariadbd
mysql 20 0 27.7g 16.3g 26492 S 22.9 13.0 135:47.21 mariadbd
mysql 20 0 27.7g 16.4g 26460 S 13.3 13.1 182:57.25 mariadbd
mysql 20 0 27.7g 16.9g 26436 S 5.0 13.5 186:18.78 mariadbd
mysql 20 0 28.2g 17.4g 26436 S 27.9 13.9 220:29.14 mariadbd
mysql 20 0 28.2g 17.4g 26436 S 10.3 13.9 240:20.25 mariadbd
mysql 20 0 28.6g 17.8g 26436 S 15.9 14.2 242:50.85 mariadbd
mysql 20 0 28.6g 17.9g 26436 S 6.6 14.2 244:48.40 mariadbd
mysql 20 0 29.0g 18.3g 26436 S 5.0 14.6 271:35.53 mariadbd
mysql 20 0 29.4g 18.5g 26480 S 11.6 14.7 327:44.08 mariadbd
mysql 20 0 29.8g 18.9g 26480 S 21.6 15.1 328:47.99 mariadbd
mysql 20 0 29.8g 18.9g 26480 S 3.7 15.1 340:27.10 mariadbd
mysql 20 0 29.8g 18.9g 26480 S 7.0 15.1 360:15.26 mariadbd
mysql 20 0 30.2g 19.6g 26460 S 3.6 15.7 397:31.67 mariadbd
mysql 20 0 31.4g 20.1g 26460 S 6.6 16.1 424:18.82 mariadbd
mysql 20 0 31.8g 20.6g 26460 S 1.7 16.5 434:33.15 mariadbd
mysql 20 0 31.8g 20.7g 26460 S 12.3 16.5 474:25.23 mariadbd
mysql 20 0 32.1g 21.1g 26444 S 9.6 16.9 501:38.46 mariadbd
mysql 20 0 32.1g 21.1g 26448 S 14.0 16.9 509:05.98
mysql 20 0 32.5g 21.6g 26448 S 10.3 17.2 524:06.26 mariadbd
mysql 20 0 33.0g 22.0g 26448 S 7.0 17.6 527:11.55 mariadbd
mysql 20 0 33.5g 22.5g 25612 S 29.9 17.9 578:12.81 mariadbd
mysql 20 0 33.5g 22.5g 25612 S 2.3 18.0 580:04.96 mariadbd
mysql 20 0 34.4g 23.4g 25044 S 17.9 18.7 647:25.39 mariadbd
mysql 20 0 35.3g 24.5g 25272 S 10.0 19.5 753:34.30 mariadbd
mysql 20 0 35.7g 24.9g 25272 S 10.0 19.9 766:17.57 mariadbd
if im trying to determine the memory usage via service status the following result -
service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.13 database server
Active: active (running) since Mon 2022-01-03 03:03:15 IST; 5 days ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 87 (limit: 820947)
Memory: 37.4G
now i just see so many indiffrent current memory usage, and for example tuning primer returns -
Configured Max Memory Limit : 16.85 G
but mysql tuner returns -
[OK] Maximum reached memory usage: 34.3G (27.34% of installed RAM)
[OK] Maximum possible memory usage: 67.1G (53.54% of installed RAM)
attaching my.cnf configurations -
performance-schema=0
#innodb_buffer_pool_size=134217728
max_allowed_packet=268435456
open_files_limit=74000
innodb_file_per_table=1
unix_socket=OFF
max_connections=200
#wait_timeout=600
#interactive_timeout=600
##
innodb_buffer_pool_size=15G
max_heap_table_size=128M
tmp_table_size=128M
#max_connections=400
table_open_cache=37000
table_definition_cache=37000
thread_cache_size=200
key_buffer_size=128M
sort_buffer_size=1M
read_buffer_size=4M
read_rnd_buffer_size=512k
join_buffer_size=3M
##
But as you can see, top command returns 24.9gb ram usage, and service status returns 37.4GB ram usage? and tuning primer saying max memory is 16.85GB, but mysql tuner says 67.1GB?
I'm completly lost in this one..
when the memory will build up until getting a stabilize memory usage?
why tuning primer, and mysql tuner memory usage is so different?from the current usage of the server itself for mariadb service?
Could anyone share his tought regards it?
Thanks!
Edit -
Hey thanks for the reply, it just keep increasing after 7 and half days -
mysql 20 0 36.2g 25.4g 25280 S 10.3 20.3 811:15.91 mariadbd
mysql 20 0 36.7g 25.8g 25296 S 5.0 20.6 840:23.93 mariadbd
mysql 20 0 37.1g 26.3g 25296 S 3.3 20.9 843:11.06 mariadbd
mysql 20 0 37.1g 26.3g 25296 S 7.6 21.0 846:27.98 mariadbd
mysql 20 0 37.1g 26.5g 25296 S 14.9 21.1 898:34.45 mariadbd
mysql 20 0 37.2g 26.5g 25272 S 13.0 21.1 933:06.45 mariadbd
mysql 20 0 37.2g 26.5g 25260 S 25.0 21.2 956:38.96 mariadbd
mysql 20 0 37.6g 26.9g 25260 S 4.3 21.5 992:54.48 mariadbd
mysql 20 0 38.0g 27.4g 25252 S 17.5 21.9 1068:31 mariadbd
mariadb.service - MariaDB 10.5.13 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Mon 2022-01-03 03:03:15 IST; 1 weeks 0 days ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 4105634 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 86 (limit: 820947)
Memory: 41.0G
total used free shared buff/cache available
Mem: 128350 35498 9313 2356 83538 89236
Swap: 0 0 0
systemd service status 37.4G looks consistent with the 35.7g figure from top (GiB vs GB perhaps explains the differences).
The 24.9G in top is the amount paged it. The difference to 37.4G is memory not paged in (or perhaps swapped out).
Tuning primer's 16.58G looks like it hasn't accounted all threads memory usage
mysqltuner's maximum looks like it has taken the pessimistic allocation of the maximum possible per thread allocation, which isn't occurring because your workload evidently doesn't to all the things that would get to this figure.
If your 5 days of uptime is pretty consistent to your workload, then 35/37G looks to be about the maximum used.
The thing that would make it rise from this point is if your 24% free buffer pool gets used. Your tuning primer shows 24% free which on 15G gives another 3.6G of potentially memory used on our current workload.
MySQL Tuner full from around 3h ago -
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 7d 9h 28m 52s (316M q [495.709 qps], 2M conn, TX: 6533G, RX: 69G)
[--] Reads / Writes: 95% / 5%
[--] Binary logging is disabled
[--] Physical Memory : 125.3G
[--] Max MySQL memory : 67.1G
[--] Other process memory: 0B
[--] Total buffers: 15.4G global + 264.8M per thread (200 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 34.3G (27.34% of installed RAM)
[OK] Maximum possible memory usage: 67.1G (53.54% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (111/316M)
[OK] Highest usage of available connections: 36% (73/200)
[OK] Aborted connections: 0.02% (605/2516029)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 0% (6K temp sorts / 78M sorts)
[!!] Joins performed without indexes: 1135010
[!!] Temporary tables created on disk: 87% (36M on disk / 41M total)
[OK] Thread cache hit rate: 99% (73 created / 2M connections)
[OK] Table cache hit rate: 99% (398M hits / 400M requests)
[OK] table_definition_cache(37000) is upper than number of tables(36425)
[OK] Open file limit used: 69% (51K/74K)
[OK] Table locks acquired immediately: 99% (242M immediate / 242M locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 36 thread(s).
[--] Using default value is good enough for your version (10.5.13-MariaDB)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[OK] Key buffer used: 99.7% (127.6M used / 128.0M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/1.3G
[OK] Read Key buffer hit rate: 99.9% (3B cached / 1M reads)
[!!] Write Key buffer hit rate: 43.1% (31M cached / 13M writes)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 15.0G/12.2G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (0.625 %): 96.0M * 1/15.0G should be equal to 25%
[--] Number of InnoDB Buffer Pool Chunk : 120 for 1 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 99.99% (7707381322 hits/ 7708055862 total)
[!!] InnoDB Write Log efficiency: 335.3% (2710443 hits/ 808371 total)
[OK] InnoDB log waits: 0.00% (0 waits / 3518814 writes)
-------- Aria Metrics ------------------------------------------------------------------------------
[--] Aria Storage Engine is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/896.0K
[OK] Aria pagecache hit rate: 97.8% (1B cached / 30M reads)
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: MIXED
[--] XA support enabled: ON
[--] Semi synchronous replication Master: OFF
[--] Semi synchronous replication Slave: OFF
[--] This is a standalone server
Heres tops -
top - 17:06:15 up 67 days, 14:15, 1 user, load average: 2.88, 2.79, 2.77
Tasks: 560 total, 3 running, 557 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.0 us, 0.6 sy, 0.1 ni, 95.3 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
MiB Mem : 128350.7 total, 7895.4 free, 35970.4 used, 84484.8 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 89024.2 avail Mem
nothing except mariadb using alot of memory, some LSPHP proccesses spawn and go as for php requests to sites hosted within the server but they using memory only for proccesing the requests and then releasing it..
but overall cpu average is around 3-12% cpu usage, so server not under heavy load.
Server specs -
Intel xeon w-2295
software raid 1 with 2 NVMEs hard drives
OS - Cloudlinux 8.5 (based of almalinux 8.5 + redhat)
server using cPanel with mariadb 10.5.3 of cPanel.
128GB ram ecc memory
SELECT COUNT() FROM information_schema.tables;
COUNT()
94
Proccess list -
Show MySQL Processes
Id User Host db Command Time State Info Progress
root localhost NULL Query 0 starting SHOW PROCESSLIST 0.000
sometimes you see around 4-14 proccessess in the proccess lists.
Variable_name
Value
alter_algorithm
DEFAULT
analyze_sample_percentage
100.000000
aria_block_size
8192
aria_checkpoint_interval
30
aria_checkpoint_log_activity
1048576
aria_encrypt_tables
OFF
aria_force_start_after_recovery_failures
0
aria_group_commit
none
aria_group_commit_interval
0
aria_log_file_size
1073741824
aria_log_purge_type
immediate
aria_max_sort_file_size
9223372036853727232
aria_page_checksum
ON
aria_pagecache_age_threshold
300
aria_pagecache_buffer_size
134217728
aria_pagecache_division_limit
100
aria_pagecache_file_hash_size
512
aria_recover_options
BACKUP,QUICK
aria_repair_threads
1
aria_sort_buffer_size
268434432
aria_stats_method
nulls_unequal
aria_sync_log_dir
NEWFILE
aria_used_for_temp_tables
ON
auto_increment_increment
1
auto_increment_offset
1
autocommit
ON
automatic_sp_privileges
ON
back_log
90
basedir
/usr/
big_tables
OFF
bind_address
binlog_annotate_row_events
ON
binlog_cache_size
32768
binlog_checksum
CRC32
binlog_commit_wait_count
0
binlog_commit_wait_usec
100000
binlog_direct_non_transactional_updates
OFF
binlog_file_cache_size
16384
binlog_format
MIXED
binlog_optimize_thread_scheduling
ON
binlog_row_image
FULL
binlog_row_metadata
NO_LOG
binlog_stmt_cache_size
32768
bulk_insert_buffer_size
8388608
character_set_client
latin1
character_set_connection
latin1
character_set_database
latin1
character_set_filesystem
binary
character_set_results
latin1
character_set_server
latin1
character_set_system
utf8
character_sets_dir
/usr/share/mysql/charsets/
check_constraint_checks
ON
collation_connection
latin1_swedish_ci
collation_database
latin1_swedish_ci
collation_server
latin1_swedish_ci
column_compression_threshold
100
column_compression_zlib_level
6
column_compression_zlib_strategy
DEFAULT_STRATEGY
column_compression_zlib_wrap
OFF
completion_type
NO_CHAIN
concurrent_insert
AUTO
connect_timeout
10
core_file
OFF
datadir
/var/lib/mysql/
date_format
%Y-%m-%d
datetime_format
%Y-%m-%d %H:%i:%s
deadlock_search_depth_long
15
deadlock_search_depth_short
4
deadlock_timeout_long
50000000
deadlock_timeout_short
10000
debug_no_thread_alarm
OFF
default_password_lifetime
0
default_regex_flags
default_storage_engine
InnoDB
default_tmp_storage_engine
default_week_format
0
delay_key_write
ON
delayed_insert_limit
100
delayed_insert_timeout
300
delayed_queue_size
1000
disconnect_on_expired_password
OFF
div_precision_increment
4
encrypt_binlog
OFF
encrypt_tmp_disk_tables
OFF
encrypt_tmp_files
OFF
enforce_storage_engine
eq_range_index_dive_limit
200
event_scheduler
OFF
expensive_subquery_limit
100
expire_logs_days
0
explicit_defaults_for_timestamp
OFF
extra_max_connections
1
extra_port
0
flush
OFF
flush_time
0
foreign_key_checks
ON
ft_boolean_syntax
+ -><()~*:""&|
ft_max_word_len
84
ft_min_word_len
4
Variable_name
Value
ft_query_expansion_limit
20
ft_stopword_file
(built-in)
general_log
OFF
general_log_file
servername.log
group_concat_max_len
1048576
gtid_binlog_pos
gtid_binlog_state
gtid_cleanup_batch_size
64
gtid_current_pos
gtid_domain_id
0
gtid_ignore_duplicates
OFF
gtid_pos_auto_engines
gtid_slave_pos
gtid_strict_mode
OFF
have_compress
YES
have_crypt
YES
have_dynamic_loading
YES
have_geometry
YES
have_openssl
YES
have_profiling
YES
have_query_cache
YES
have_rtree_keys
YES
have_ssl
DISABLED
have_symlink
YES
histogram_size
254
histogram_type
DOUBLE_PREC_HB
host_cache_size
328
hostname
hostname
idle_readonly_transaction_timeout
0
idle_transaction_timeout
0
idle_write_transaction_timeout
0
ignore_builtin_innodb
OFF
ignore_db_dirs
in_predicate_conversion_threshold
1000
init_connect
init_file
init_slave
innodb_adaptive_flushing
ON
innodb_adaptive_flushing_lwm
10.000000
innodb_adaptive_hash_index
OFF
innodb_adaptive_hash_index_parts
8
innodb_adaptive_max_sleep_delay
0
innodb_autoextend_increment
64
innodb_autoinc_lock_mode
1
innodb_background_scrub_data_check_interval
0
innodb_background_scrub_data_compressed
OFF
innodb_background_scrub_data_interval
0
innodb_background_scrub_data_uncompressed
OFF
innodb_buf_dump_status_frequency
0
innodb_buffer_pool_chunk_size
134217728
innodb_buffer_pool_dump_at_shutdown
ON
innodb_buffer_pool_dump_now
OFF
innodb_buffer_pool_dump_pct
25
innodb_buffer_pool_filename
ib_buffer_pool
innodb_buffer_pool_instances
1
innodb_buffer_pool_load_abort
OFF
innodb_buffer_pool_load_at_startup
ON
innodb_buffer_pool_load_now
OFF
innodb_buffer_pool_size
16106127360
innodb_change_buffer_max_size
25
innodb_change_buffering
all
innodb_checksum_algorithm
full_crc32
innodb_cmp_per_index_enabled
OFF
innodb_commit_concurrency
0
innodb_compression_algorithm
zlib
innodb_compression_default
OFF
innodb_compression_failure_threshold_pct
5
innodb_compression_level
6
innodb_compression_pad_pct_max
50
innodb_concurrency_tickets
0
innodb_data_file_path
ibdata1:12M:autoextend
innodb_data_home_dir
innodb_deadlock_detect
ON
innodb_default_encryption_key_id
1
innodb_default_row_format
dynamic
innodb_defragment
OFF
innodb_defragment_fill_factor
0.900000
innodb_defragment_fill_factor_n_recs
20
innodb_defragment_frequency
40
innodb_defragment_n_pages
7
innodb_defragment_stats_accuracy
0
innodb_disable_sort_file_cache
OFF
innodb_disallow_writes
OFF
innodb_doublewrite
ON
innodb_encrypt_log
OFF
innodb_encrypt_tables
OFF
innodb_encrypt_temporary_tables
OFF
innodb_encryption_rotate_key_age
1
innodb_encryption_rotation_iops
100
innodb_encryption_threads
0
innodb_fast_shutdown
1
innodb_fatal_semaphore_wait_threshold
600
innodb_file_format
innodb_file_per_table
ON
innodb_fill_factor
100
innodb_flush_log_at_timeout
1
innodb_flush_log_at_trx_commit
1
innodb_flush_method
fsync
innodb_flush_neighbors
1
innodb_flush_sync
ON
Variable_name
Value
innodb_flushing_avg_loops
30
innodb_force_load_corrupted
OFF
innodb_force_primary_key
OFF
innodb_force_recovery
0
innodb_ft_aux_table
innodb_ft_cache_size
8000000
innodb_ft_enable_diag_print
OFF
innodb_ft_enable_stopword
ON
innodb_ft_max_token_size
84
innodb_ft_min_token_size
3
innodb_ft_num_word_optimize
2000
innodb_ft_result_cache_limit
2000000000
innodb_ft_server_stopword_table
innodb_ft_sort_pll_degree
2
innodb_ft_total_cache_size
640000000
innodb_ft_user_stopword_table
innodb_immediate_scrub_data_uncompressed
OFF
innodb_instant_alter_column_allowed
add_drop_reorder
innodb_io_capacity
200
innodb_io_capacity_max
2000
innodb_large_prefix
innodb_lock_schedule_algorithm
fcfs
innodb_lock_wait_timeout
50
innodb_log_buffer_size
16777216
innodb_log_checksums
ON
innodb_log_compressed_pages
ON
innodb_log_file_size
100663296
innodb_log_files_in_group
1
innodb_log_group_home_dir
./
innodb_log_optimize_ddl
OFF
innodb_log_write_ahead_size
8192
innodb_lru_flush_size
32
innodb_lru_scan_depth
1536
innodb_max_dirty_pages_pct
90.000000
innodb_max_dirty_pages_pct_lwm
0.000000
innodb_max_purge_lag
0
innodb_max_purge_lag_delay
0
innodb_max_purge_lag_wait
4294967295
innodb_max_undo_log_size
10485760
innodb_monitor_disable
innodb_monitor_enable
innodb_monitor_reset
innodb_monitor_reset_all
innodb_old_blocks_pct
37
innodb_old_blocks_time
1000
innodb_online_alter_log_max_size
134217728
innodb_open_files
36885
innodb_optimize_fulltext_only
OFF
innodb_page_cleaners
1
innodb_page_size
16384
innodb_prefix_index_cluster_optimization
OFF
innodb_print_all_deadlocks
OFF
innodb_purge_batch_size
300
innodb_purge_rseg_truncate_frequency
128
innodb_purge_threads
4
innodb_random_read_ahead
OFF
innodb_read_ahead_threshold
56
innodb_read_io_threads
4
innodb_read_only
OFF
innodb_replication_delay
0
innodb_rollback_on_timeout
OFF
innodb_scrub_log
OFF
innodb_scrub_log_speed
256
innodb_sort_buffer_size
1048576
innodb_spin_wait_delay
4
innodb_stats_auto_recalc
ON
innodb_stats_include_delete_marked
OFF
innodb_stats_method
nulls_equal
innodb_stats_modified_counter
0
innodb_stats_on_metadata
OFF
innodb_stats_persistent
ON
innodb_stats_persistent_sample_pages
20
innodb_stats_traditional
ON
innodb_stats_transient_sample_pages
8
innodb_status_output
OFF
innodb_status_output_locks
OFF
innodb_strict_mode
ON
innodb_sync_array_size
1
innodb_sync_spin_loops
30
innodb_table_locks
ON
innodb_temp_data_file_path
ibtmp1:12M:autoextend
innodb_thread_concurrency
0
innodb_thread_sleep_delay
0
innodb_tmpdir
innodb_undo_directory
./
innodb_undo_log_truncate
OFF
innodb_undo_logs
128
innodb_undo_tablespaces
0
innodb_use_atomic_writes
ON
innodb_use_native_aio
ON
innodb_version
10.5.13
innodb_write_io_threads
4
interactive_timeout
28800
join_buffer_size
3145728
join_buffer_space_limit
2097152
join_cache_level
2
keep_files_on_create
OFF
key_buffer_size
134217728
key_cache_age_threshold
300
key_cache_block_size
1024
Variable_name
Value
key_cache_division_limit
100
key_cache_file_hash_size
512
key_cache_segments
0
large_files_support
ON
large_page_size
0
large_pages
OFF
lc_messages
en_US
lc_messages_dir
lc_time_names
en_US
license
GPL
local_infile
ON
lock_wait_timeout
86400
locked_in_memory
OFF
log_bin
OFF
log_bin_basename
log_bin_compress
OFF
log_bin_compress_min_len
256
log_bin_index
log_bin_trust_function_creators
OFF
log_disabled_statements
sp
log_error
/var/lib/mysql/hostname.err
log_output
FILE
log_queries_not_using_indexes
OFF
log_slave_updates
OFF
log_slow_admin_statements
ON
log_slow_disabled_statements
sp
log_slow_filter
admin,filesort,filesort_on_disk,filesort_priority_...
log_slow_rate_limit
1
log_slow_slave_statements
ON
log_slow_verbosity
log_tc_size
24576
log_warnings
2
long_query_time
10.000000
low_priority_updates
OFF
lower_case_file_system
OFF
lower_case_table_names
0
master_verify_checksum
OFF
max_allowed_packet
268435456
max_binlog_cache_size
18446744073709547520
max_binlog_size
1073741824
max_binlog_stmt_cache_size
18446744073709547520
max_connect_errors
100
max_connections
200
max_delayed_threads
20
max_digest_length
1024
max_error_count
64
max_heap_table_size
134217728
max_insert_delayed_threads
20
max_join_size
18446744073709551615
max_length_for_sort_data
1024
max_password_errors
4294967295
max_prepared_stmt_count
16382
max_recursive_iterations
4294967295
max_relay_log_size
1073741824
max_rowid_filter_size
131072
max_seeks_for_key
4294967295
max_session_mem_used
9223372036854775807
max_sort_length
1024
max_sp_recursion_depth
0
max_statement_time
0.000000
max_tmp_tables
32
max_user_connections
0
max_write_lock_count
4294967295
metadata_locks_cache_size
1024
metadata_locks_hash_instances
8
min_examined_row_limit
0
mrr_buffer_size
262144
myisam_block_size
1024
myisam_data_pointer_size
6
myisam_max_sort_file_size
9223372036853727232
myisam_mmap_size
18446744073709551615
myisam_recover_options
BACKUP,QUICK
myisam_repair_threads
1
myisam_sort_buffer_size
134216704
myisam_stats_method
NULLS_UNEQUAL
myisam_use_mmap
OFF
mysql56_temporal_format
ON
net_buffer_length
16384
net_read_timeout
30
net_retry_count
10
net_write_timeout
60
old
OFF
old_alter_table
DEFAULT
old_mode
old_passwords
OFF
open_files_limit
74000
optimizer_max_sel_arg_weight
32000
optimizer_prune_level
1
optimizer_search_depth
62
optimizer_selectivity_sampling_limit
100
optimizer_switch
index_merge=on,index_merge_union=on,index_merge_so...
optimizer_trace
enabled=off
optimizer_trace_max_mem_size
1048576
optimizer_use_condition_selectivity
4
performance_schema
OFF
performance_schema_accounts_size
-1
performance_schema_digests_size
-1
performance_schema_events_stages_history_long_size
-1
performance_schema_events_stages_history_size
-1
performance_schema_events_statements_history_long_...
-1
Variable_name
Value
performance_schema_events_statements_history_size
-1
performance_schema_events_transactions_history_lon...
-1
performance_schema_events_transactions_history_siz...
-1
performance_schema_events_waits_history_long_size
-1
performance_schema_events_waits_history_size
-1
performance_schema_hosts_size
-1
performance_schema_max_cond_classes
90
performance_schema_max_cond_instances
-1
performance_schema_max_digest_length
1024
performance_schema_max_file_classes
80
performance_schema_max_file_handles
32768
performance_schema_max_file_instances
-1
performance_schema_max_index_stat
-1
performance_schema_max_memory_classes
320
performance_schema_max_metadata_locks
-1
performance_schema_max_mutex_classes
210
performance_schema_max_mutex_instances
-1
performance_schema_max_prepared_statements_instanc...
-1
performance_schema_max_program_instances
-1
performance_schema_max_rwlock_classes
50
performance_schema_max_rwlock_instances
-1
performance_schema_max_socket_classes
10
performance_schema_max_socket_instances
-1
performance_schema_max_sql_text_length
1024
performance_schema_max_stage_classes
160
performance_schema_max_statement_classes
222
performance_schema_max_statement_stack
10
performance_schema_max_table_handles
-1
performance_schema_max_table_instances
-1
performance_schema_max_table_lock_stat
-1
performance_schema_max_thread_classes
50
performance_schema_max_thread_instances
-1
performance_schema_session_connect_attrs_size
-1
performance_schema_setup_actors_size
-1
performance_schema_setup_objects_size
-1
performance_schema_users_size
-1
pid_file
/var/lib/mysql/servername.pid
plugin_dir
/usr/lib64/mysql/plugin/
plugin_maturity
gamma
port
3306
preload_buffer_size
32768
profiling
OFF
profiling_history_size
15
progress_report_time
5
protocol_version
10
proxy_protocol_networks
query_alloc_block_size
16384
query_cache_limit
1048576
query_cache_min_res_unit
4096
query_cache_size
1048576
query_cache_strip_comments
OFF
query_cache_type
OFF
query_cache_wlock_invalidate
OFF
query_prealloc_size
24576
range_alloc_block_size
4096
read_binlog_speed_limit
0
read_buffer_size
4194304
read_only
OFF
read_rnd_buffer_size
524288
relay_log
relay_log_basename
relay_log_index
relay_log_info_file
relay-log.info
relay_log_purge
ON
relay_log_recovery
OFF
relay_log_space_limit
0
replicate_annotate_row_events
ON
replicate_do_db
replicate_do_table
replicate_events_marked_for_skip
REPLICATE
replicate_ignore_db
replicate_ignore_table
replicate_wild_do_table
replicate_wild_ignore_table
report_host
report_password
report_port
3306
report_user
require_secure_transport
OFF
rowid_merge_buff_size
8388608
rpl_semi_sync_master_enabled
OFF
rpl_semi_sync_master_timeout
10000
rpl_semi_sync_master_trace_level
32
rpl_semi_sync_master_wait_no_slave
ON
rpl_semi_sync_master_wait_point
AFTER_COMMIT
rpl_semi_sync_slave_delay_master
OFF
rpl_semi_sync_slave_enabled
OFF
rpl_semi_sync_slave_kill_conn_timeout
5
rpl_semi_sync_slave_trace_level
32
secure_auth
ON
secure_file_priv
secure_timestamp
NO
server_id
1
session_track_schema
ON
session_track_state_change
OFF
session_track_system_variables
autocommit,character_set_client,character_set_conn...
session_track_transaction_info
OFF
skip_external_locking
ON
skip_name_resolve
OFF
skip_networking
OFF
Variable_name
Value
skip_show_database
OFF
slave_compressed_protocol
OFF
slave_ddl_exec_mode
IDEMPOTENT
slave_domain_parallel_threads
0
slave_exec_mode
STRICT
slave_load_tmpdir
/tmp
slave_max_allowed_packet
1073741824
slave_net_timeout
60
slave_parallel_max_queued
131072
slave_parallel_mode
optimistic
slave_parallel_threads
0
slave_parallel_workers
0
slave_run_triggers_for_rbr
NO
slave_skip_errors
OFF
slave_sql_verify_checksum
ON
slave_transaction_retries
10
slave_transaction_retry_errors
1158,1159,1160,1161,1205,1213,1429,2013,12701
slave_transaction_retry_interval
0
slave_type_conversions
slow_launch_time
2
slow_query_log
OFF
slow_query_log_file
servername-slow.log
socket
/var/lib/mysql/mysql.sock
sort_buffer_size
1048576
sql_auto_is_null
OFF
sql_big_selects
ON
sql_buffer_result
OFF
sql_if_exists
OFF
sql_log_bin
ON
sql_log_off
OFF
sql_mode
STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_...
sql_notes
ON
sql_quote_show_create
ON
sql_safe_updates
OFF
sql_select_limit
18446744073709551615
sql_slave_skip_counter
0
sql_warnings
OFF
ssl_ca
ssl_capath
ssl_cert
ssl_cipher
ssl_crl
ssl_crlpath
ssl_key
standard_compliant_cte
ON
storage_engine
InnoDB
stored_program_cache
256
strict_password_validation
ON
sync_binlog
0
sync_frm
ON
sync_master_info
10000
sync_relay_log
10000
sync_relay_log_info
10000
system_time_zone
IST
system_versioning_alter_history
ERROR
system_versioning_asof
DEFAULT
table_definition_cache
37000
table_open_cache
36885
table_open_cache_instances
1
tcp_keepalive_interval
0
tcp_keepalive_probes
0
tcp_keepalive_time
0
tcp_nodelay
ON
thread_cache_size
200
thread_handling
one-thread-per-connection
thread_pool_dedicated_listener
OFF
thread_pool_exact_stats
OFF
thread_pool_idle_timeout
60
thread_pool_max_threads
65536
thread_pool_oversubscribe
3
thread_pool_prio_kickup_timer
1000
thread_pool_priority
auto
thread_pool_size
36
thread_pool_stall_limit
500
thread_stack
299008
time_format
%H:%i:%s
time_zone
SYSTEM
tls_version
TLSv1.1,TLSv1.2,TLSv1.3
tmp_disk_table_size
18446744073709551615
tmp_memory_table_size
134217728
tmp_table_size
134217728
tmpdir
/tmp
Couldn't paste full global prams as stack limit but thats around 95% of it.
We have disabled swap in the previous my.cnf edit, as for mariadb even when there are alot of free memory within the system is still building swap until swap reached 100%(4GB of swap).

mkdir throws No space left on device , while creating a large file is fine( plenty space and inodes available )

very strange behaviour
I cannot create a directory
[root#XXXXXX DEV]# mkdir 1
mkdir: cannot create directory `1': No space left on device
[root#dev-albert DEV]# pwd
/deployment/.octopus/Applications/OctopusServer/DEV
[root#XXXXXX DEV]# df -P /deployment
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/deploymentvg-deployment 10321208 5229888 4567096 54%
/deployment
[root#dev-albert DEV]# df -Pi /deployment
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/deploymentvg-deployment 655360 69129 586231 11%
/deployment
As you can see, plenty of space , good number of inodes free.
Does anyone have any clue what is happening with my system.
[root#dev-albert DEV]# dmsetup ls
rootvg-tmp (252:6)
rootvg-usr (252:7)
rootvg-var (252:8)
deploymentvg-usropenv (252:3)
deploymentvg-deployment (252:2)
rootvg-agent (252:4)
rootvg-oracle (252:11)
rootvg-varlock (252:9)
rootvg-deployment (252:5)
rootvg-swap (252:1)
rootvg-root (252:0)
rootvg-varspool (252:10)
top output
top - 14:44:35 up 347 days, 20:40, 2 users, load average: 2.02, 2.02, 2.05
Tasks: 125 total, 2 running, 123 sleeping, 0 stopped, 0 zombie
Cpu(s):100.0%us, 0.0%sy, 0.0%ni,117100.0%id,-42916200.0%wa, 0.0%hi,
0.0%si,200.0%st
Mem: 4071932k total, 3394132k used, 677800k free, 780312k buffers
Swap: 4194300k total, 22604k used, 4171696k free, 1742552k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
747 root 20 0 0 0 0 S 3.0 0.0 303:33.05 jbd2/dm-2-8
20679 root 20 0 0 0 0 S 2.7 0.0 0:14.24 kworker/0:2
16319 root 20 0 0 0 0 R 2.3 0.0 266:30.45 flush-252:2
When I run mkdir with strace
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99158576, ...}) = 0
mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd4c4b04000
close(3) = 0
mkdir("1", 0777) = -1 ENOSPC (No space left on
device)
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
write(2, ": No space left on device", 25: No space left on device) = 25
uname output
Linux 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
Sometimes that can be caused by the b-tree used by ext4 as directory index hitting its height limit. If you get the No space left on device error on mkdir for some names but not others, or there's plenty of space and inodes, check your dmesg for these warnings:
EXT4-fs warning (device dm-0): ext4_dx_add_entry:2226: Directory (ino: 80087286) index full, reach max htree level :2
EXT4-fs warning (device dm-0): ext4_dx_add_entry:2230: Large directory feature is not enabled on this filesystem
That means you're hitting the b-tree limit, and on a pinch you can enable large directory with:
tune2fs -O large_dir <dev>
It doesn't require unounting or rebooting, and it will increase the limit from 10M to 2B. Depending on what you're doing you're likely to hit performance bottlenecks or actually filling the disk before hitting the limit again, but I recommend rethinking your directory structure to avoid creating too many files and subdirectories in the same directory, and use the above solution only in an emergency.

NFS v4 with fast network and average IOPS disk. Load increase high on large file transfer

NFS v4 with fast network and average IOPS disk. Load increase high on large file transfer.
The problem seems to be IOPS.
The test case:
/etc/exports
server# /mnt/exports 192.168.6.0/24(rw,sync,no_subtree_check,no_root_squash,fsid=0)
server# /mnt/exports/nfs 192.168.6.0/24(rw,sync,no_subtree_check,no_root_squash)
client# mount -t nfs 192.168.6.131:/nfs /mnt/nfstest -vvv
(or client# mount -t nfs 192.168.6.131:/nfs /mnt/nfstest -o nfsvers=4,tcp,port=2049,async -vvv)
It works well wits 'sync' flag but the transger drops form 50MB/s to 500kb/s
http://ubuntuforums.org/archive/index.php/t-1478413.html
The topic seems to be solved by reducing wsize to wsize=300 - small improvement but not the solution.
Simple test with dd:
client# dd if=/dev/zero bs=1M count=6000 |pv | dd of=/mnt/nfstest/delete_me
server# iotop
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
1863 be/4 root 0.00 B/s 14.17 M/s 0.00 % 21.14 % [nfsd]
1864 be/4 root 0.00 B/s 7.42 M/s 0.00 % 17.39 % [nfsd]
1858 be/4 root 0.00 B/s 6.32 M/s 0.00 % 13.09 % [nfsd]
1861 be/4 root 0.00 B/s 13.26 M/s 0.00 % 12.03 % [nfsd]
server# dstat -r --top-io-adv --top-io --top-bio --aio -l -n -m
--io/total- -------most-expensive-i/o-process------- ----most-expensive---- ----most-expensive---- async ---load-avg--- -NET/total- ------memory-usage-----
read writ|process pid read write cpu| i/o process | block i/o process | #aio| 1m 5m 15m | recv send| used buff cach free
10.9 81.4 |init [2] 1 5526B 20k0.0%|init [2] 5526B 20k|nfsd 10B 407k| 0 |2.92 1.01 0.54| 0 0 |29.3M 78.9M 212M 4184k
1.00 1196 |sshd: root#pts/0 1943 1227B1264B 0%|sshd: root#1227B 1264B|nfsd 0 15M| 0 |2.92 1.01 0.54| 44M 319k|29.1M 78.9M 212M 4444k
0 1365 |sshd: root#pts/0 1943 485B 528B 0%|sshd: root# 485B 528B|nfsd 0 16M| 0 |2.92 1.01 0.54| 51M 318k|29.5M 78.9M 212M 4708k
Do You know any way of limiting the load without big changes in the configuration?
I do consider limiting the network speed with wondershaper or iptables, though it is not nice since other traffic would be harmed as well.
Someone suggested cgroups - may be worth solving - but it still it is not my 'feng shui' - I would hope to find solution in NFS config - since the problem is here, would be nice to have in-one-place-solution.
If that would be possible to increase 'sync' speed to 10-20MB/s that would be enough for me.
I think I nailed it:
On the server, change disk scheduller:
for i in /sys/block/sd*/queue/scheduler ; do echo deadline > $i ; done
additionally (small improvement - find the best value for You):
/etc/default/nfs-kernel-server
# Number of servers to start up
-RPCNFSDCOUNT=8
+RPCNFSDCOUNT=2
restart services
/etc/init.d/rpcbind restart
/etc/init.d/nfs-kernel-server restart
ps:
My current configs
server:
/etc/exports
/mnt/exports 192.168.6.0/24(rw,no_subtree_check,no_root_squash,fsid=0)
/mnt/exports/nfs 192.168.6.0/24(rw,no_subtree_check,no_root_squash)
client:
/etc/fstab
192.168.6.131:/nfs /mnt/nfstest nfs rsize=32768,wsize=32768,tcp,port=2049 0 0

Batch file how to ping

How do I ping 192.168.1.1 10 times with a break of 3 centiseconds after each ping! In command prompt. The ping command is really confusing.
You should propably get fping and use that:
fping -c 10 -p 30ms 192.168.1.1
This will send 10 packets to 192.168.1.1, interval between each packet is 30ms
fping because it allows flooding if required, 30ms interval between sends without waiting reply is propably considered flooding anyway...
With -t msecs you can add timeout for individual packets, this timeout is non blocking so interval between packets is always same, in this case -p 30 it is 30ms.
Packet loss with fping
Because of this, fping -p 30ms -t 10000 -s example.com may first show some packet loss but after waiting before summary is printed it should have enough time (10sec) to receive all packets that is not received in 30ms frame and final summmary shows that there is no real loss at all.
Example of packet exceeding interval but arriving within timeout:
Cmd:
fping -c 10 -p 30ms -s -t 10000 -e somehost.com
Output:
somehost.com : [0], 84 bytes, 299 ms (299 avg, 90% loss)
somehost.com : [1], 84 bytes, 269 ms (284 avg, 80% loss)
somehost.com : [2], 84 bytes, 239 ms (269 avg, 70% loss)
somehost.com : [3], 84 bytes, 209 ms (254 avg, 60% loss)
somehost.com : [4], 84 bytes, 179 ms (239 avg, 50% loss)
somehost.com : [5], 84 bytes, 158 ms (225 avg, 40% loss)
somehost.com : [6], 84 bytes, 128 ms (212 avg, 30% loss)
somehost.com : [7], 84 bytes, 137 ms (202 avg, 20% loss)
somehost.com : [8], 84 bytes, 137 ms (195 avg, 10% loss)
somehost.com : [9], 84 bytes, 127 ms (188 avg, 0% loss)
somehost.com : xmt/rcv/%loss = 10/10/0%, min/avg/max = 127/188/299
1 targets
1 alive
0 unreachable
0 unknown addresses
0 timeouts (waiting for response)
10 ICMP Echos sent
10 ICMP Echo Replies received
0 other ICMP received
127 ms (min round trip time)
188 ms (avg round trip time)
299 ms (max round trip time)
0.410 sec (elapsed real time)
As you can see, finally there is no loss at all 0 timeouts and 10 ICMP Echo Replies received out of 10 ICMP Echos sent.
Here you can find fping for linux.
And here fping for windows.
Assuming you are in a Windows Command Line:
ping 192.168.1.1 -n 10 -w 10
Here is a help page: link
It's ping 192.168.1.1 /n 10 /w 30

Resources