Why is 2700x slower than i7-6700 in redis benchmark? - performance

I don't understand why is 2700x slower than i7-6700 in redis benchmark?
What else should I add?
Below are my tests.
1st system
OS : CentOS Linux release 7.6.1810 (Core)
Linux localhost.localdomain 5.2.8-1.el7.elrepo.x86_64 #1 SMP Fri Aug 9 13:40:33 EDT 2019 x86_64 x86_64 x86_64 GNU/Linux
CPU : AMD Ryzen 7 2700X Eight-Core Processor (pinnacle ridge 2700x)
RAM : 16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 3000 MHz (0.3 ns) * 2
[root#localhost ~]# redis-cli --latency
min: 0, max: 1, avg: 0.21 (5042 samples)
[root#localhost ~]# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -t set -q
SET: 110619.47 requests per second
[root#localhost ~]# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -t get -q
GET: 138504.16 requests per second
2nd system
OS : CentOS release 6.7 (Final)
Linux dmlocalhost.localdoamin 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 23 03:35:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
CPU : Intel(R) Core(TM) i7-6700 CPU # 3.40GHz
RAM : 16GiB DIMM Synchronous 2133 MHz (0.5 ns)
[root#dmvault ~]# redis-cli --latency
min: 0, max: 1, avg: 0.11 (5038 samples)
[root#dmvault ~]# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -t set -q
SET: 248138.95 requests per second
[root#dmvault ~]# redis-benchmark -h 127.0.0.1 -p 6379 -n 100000 -t get -q
GET: 244498.77 requests per second

Related

How to create specific, automated bandwidth/network traffic for experiment..?

So for my job I need to do an experiment..
The essence and part where I get stuck at now is how to create a specific amount of bandwidth/network traffic. From either Linux or windows, (I have both a Kali and Win10 VM). To a target Win10 pc which monitors it's resources to see the reaction to the traffic.
Preferably 3 different amounts of traffic with a certain time between them, like a scripted sleep timer or something..
So like the following:
Sleep 180 seconds
Send 10mbps for 120 seconds
Sleep 180 seconds
Send 25mbps for 120 seconds
Sleep 180 seconds
Send 50mbps for 120 seconds
Exit
Now this shouldn't be as hard as I'm thinking of it to be right?
Any pointers on some software or scripts I could use for this?
Thanks in advance
You can use iperf3, a tool for stress testing and measuring network performance, along with basic bash scripting to accomplish this. iperf3 is cross-platform, so it is supported on both Kali Linux and Win 10.
On Kali Linux, I used the system package manager to install it:
apt install iperf3
On Windows, I downloaded the 64 bit binary from the iperf3 download site.
Then used the following command to start an iperf3 server:
iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
This will start the server listening on a particular port as shown above. Then on my Kali Linux instance, I use iperf3 again as a client to connect to the server:
iperf3 -c <address-of-server> -b 25M -t 7
[ 5] local XXX.XXX.XXX.XXX port 42650 connected to XXX.XXX.XXX.XXX port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 2.98 MBytes 25.0 Mbits/sec 0 133 KBytes
[ 5] 1.00-2.00 sec 3.00 MBytes 25.2 Mbits/sec 0 133 KBytes
[ 5] 2.00-3.00 sec 3.00 MBytes 25.2 Mbits/sec 0 133 KBytes
[ 5] 3.00-4.00 sec 3.00 MBytes 25.2 Mbits/sec 0 133 KBytes
[ 5] 4.00-5.00 sec 3.00 MBytes 25.2 Mbits/sec 0 133 KBytes
[ 5] 5.00-6.00 sec 3.00 MBytes 25.2 Mbits/sec 2 133 KBytes
[ 5] 6.00-7.00 sec 3.00 MBytes 25.2 Mbits/sec 1 133 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-7.00 sec 21.0 MBytes 25.1 Mbits/sec 3 sender
[ 5] 0.00-7.00 sec 21.0 MBytes 25.1 Mbits/sec receiver
The -b option allows me to specify the bit rate, in the example above 25 Mbits/sec and the -t option allows specifying how long it should run, in this case 7 seconds.
You can easily use this tool in a script to achieve the behavior you want, for example:
#!/bin/bash
echo "Sleeping for 180 seconds"
sleep 180
echo "Stress testing at 10Mb/s for 120 seconds"
iperf3 -c mywinserver.local -b 10M -t 120
echo "Sleeping for 180 seconds"
sleep 180
echo "Stress testing at 25Mb/s for 120 seconds"
iperf3 -c mywinserver.local -b 25M -t 120
echo "Sleeping for 180 seconds"
sleep 180
echo "Stress testing at 50Mb/s for 120 seconds"
iperf3 -c mywinserver.local -b 50M -t 120

Memory usage per process

How can one see the output of the memory usage per process in Windows using bash (Git bash) and without any additional tools installation?
I read about top command but there is no such thing in the default version of bash. Also, I have read about ps but it does not give the memory usage at all as in some examples I have seen (maybe some version has been changed).
Since Linux processes in WSL run in a container (conceptually similar to Docker), they can only see processes in the same container, nothing else.
You can see the virtual and resident size of processes in WSL by issuing the following command:
ps -eHww -o uid,pid,ppid,psr,vsz,rss,stime,time,cmd
Outputs:
max#supernova:~$ uname -a
Linux supernova 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
max#supernova:~$ ps -eHww -o uid,pid,ppid,psr,vsz,rss,stime,time,cmd
UID PID PPID PSR VSZ RSS STIME TIME CMD
0 1 0 0 8324 156 23:36 00:00:00 /init
0 3 1 0 8328 156 23:36 00:00:00 /init
1000 4 3 0 16796 3424 23:36 00:00:00 -bash
1000 35 4 0 17084 1716 23:57 00:00:00 ps -eHww -o uid,pid,ppid,psr,vsz,rss,stime,time,cmd

Output network speed in mbit/s using netcat

I'm using netcat piped thorugh pv to measure network speed
Server A
netcat -l -q -1 -p 1234 | pv > /dev/null
Server B
dd if=/dev/zero bs=10M count=1 | nc -v -n 10.10.10.2 1234
Result is returned on server B as
(UNKNOWN) [10.10.10.2] 1234 (?) open
1+0 records in
1+0 records out
10485760 bytes (10 MB) copied, 5.24922 s, 2.0 MB/s
What I need to do is convert MB/s to Mbit/s and output that so in script I can do
echo $speed
16 Mbits/sec
Also I need netcat to always be listengin on Server A and not close after the transfer has completed. I've tries the -k and -q -1 switches but no luck.

not able to load my module symbols in crash utility

I am facing issue while debugging vmcore with crash on centos7. I am not able to load my module symbols.
sudo crash ../vmlinux-3.10.0-123.el7.x86_64 vmcore
KERNEL: ../vmlinux-3.10.0-123.el7.x86_64
DUMPFILE: vmcore [PARTIAL DUMP]
CPUS: 1
DATE: Tue Aug 18 14:53:54 2015
UPTIME: 20:33:05
LOAD AVERAGE: 2.39, 1.21, 0.61
TASKS: 340
NODENAME: localhost.localdomain
RELEASE: 3.10.0-123.el7.x86_64
VERSION: #1 SMP Mon Jun 30 12:09:22 UTC 2014
MACHINE: x86_64 (3092 Mhz)
MEMORY: 1.2 GB
PANIC: "Oops: 0002 [#1] SMP " (check log for details)
PID: 8327
COMMAND: "cat"
TASK: ffff8800279a6660 [THREAD_INFO: ffff880002ade000]
CPU: 0
STATE: TASK_RUNNING (PANIC)
crash> mod -s ext4
MODULE NAME SIZE OBJECT FILE
ffffffffa016f320 ext4 528957 /lib/modules/3.10.0-123.el7.x86_64/kernel/fs/ext4/ext4.ko
crash> ls
ioctal-drv.ko vmcore vmcore-dmesg.txt
crash> mod -s ./ioctal-drv.ko
Usage:
mod -s module [objfile] | -d module | -S [directory] [-D|-t|-r|-R|-o|-g]
Enter "help mod" for details.
crash> mod -s ioctal-drv.ko
Usage:
mod -s module [objfile] | -d module | -S [directory] [-D|-t|-r|-R|-o|-g]
Enter "help mod" for details.
$ ls -a /sys/module/ioctal_drv/sections/
. .. .bss .data .gnu.linkonce.this_module __mcount_loc .note.gnu.build-id .rodata .rodata.str1.1 .rodata.str1.8 .strtab .symtab .text
Could any one tell me why i am not able to load module symbols? Thanks

Finding the IP from the PID

I'm a newbie to shell programming and I'd like to find the IP address from the process ID. Right now, I'm able to get the PID for a specific process from :
vmname=$1
pid=`ps aux | grep $vmname | awk 'NR==1{printf("%s\n", $2) }'`
echo $pid
The above method returns the PID but how do I get the port from the pid? If I get the port, is there a command to get the IP address as well?
I'm using Ubuntu 11.04 and the above script is actually trying to find out the IP of a virtual machine running on KVM using this method.
Thanks!
You can employ the lsof utility. It gives the list of open files for a process. Use lsof -p pid . You need to grep on the output to get the port values for eg. something like this - lsof -p pid| grep TCP. This will list all the ports opened or connected to by the process. Refer to the manual of the utility. For most systems the utility comes pre-bundled with your OS. However, if it is not pre-bundled then you need to install this utility.
The PID and the computer's IP Address are two completely unrelated things.
PID stands for Process ID, and it's a handle for the OS to keep track of your program, among other things.
IP address is related to a network interface. Most computers have one or two of these (in the case of ethernet card/wireless device.)
Anyway, one way to get your computer's IP address is something similar to the following...There are quite possibly better ways to do it and I just don't know 'em...
$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 60:eb:69:96:da:87
inet addr:192.168.1.112 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::62eb:69ff:fe96:da87/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:876533 errors:0 dropped:0 overruns:0 frame:0
TX packets:560999 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:229205080 (229.2 MB) TX bytes:136756800 (136.7 MB)
Interrupt:40 Base address:0x8000
$ ifconfig eth0 | grep "inet addr"
inet addr:192.168.1.112 Bcast:192.168.1.255 Mask:255.255.255.0
$ ifconfig eth0 | grep "inet addr" | cut -d ":" -f 2
192.168.1.112 Bcast
$ ifconfig eth0 | grep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1
192.168.1.112
So the last command will get you what you want inside your script. The rest are just there to show you how I built up to the last command.
Before I start lsof should be used as suggested by #Drona if lsof and if root/su/sudo access is available.
For completness I was investigating this for getting the IP address of currently logged in chrooted SFTP users for a nagios script I did not want to have to create a sudoers rule for.
Easy way (not as easy as lsof and needs root but for completeness)
Step 1
$ ps -ef | grep ssh
UID PID PPID C STIME TTY TIME CMD
root 2479 14186 0 17:05 ? 00:00:00 sshd: sftpuser [priv]
1008 2481 2479 0 17:06 ? 00:00:00 sshd: sftpuser#notty
1008 2482 2481 0 17:06 ? 00:00:00 sshd: sftpuser#internal-sftp
root 2483 14186 0 17:06 ? 00:00:00 sshd: ttyuser [priv]
ttyuser 2485 2483 0 17:06 ? 00:00:00 sshd: ttyuser#pts/0
Above you can see the PID for the ssh users (added the ps columns for easier interpretation)
Step 2
sudo lsof -p 2481 | grep TCP
sshd 2481 root 3u IPv4 29176657 0t0 TCP 192.168.1.2:44156 (ESTABLISHED)
Alternative (more complex has the possibility of not needing rood)
Step 2 - Requires root access but is optional
$ sudo ls -l /proc/2481/fd
total 0
lrwx------ 1 root root 64 Jul 3 17:07 0 -> /dev/null
lrwx------ 1 root root 64 Jul 3 17:07 1 -> /dev/null
lr-x------ 1 root root 64 Jul 3 17:07 11 -> pipe:[29209918]
lrwx------ 1 root root 64 Jul 3 17:07 2 -> /dev/null
lrwx------ 1 root root 64 Jul 3 17:07 3 -> socket:[29209894]
lrwx------ 1 root root 64 Jul 3 17:07 5 -> socket:[29211080]
lr-x------ 1 root root 64 Jul 3 17:07 6 -> pipe:[29209915]
l-wx------ 1 root root 64 Jul 3 17:07 7 -> pipe:[29209915]
l-wx------ 1 root root 64 Jul 3 17:07 8 -> pipe:[29209916]
lr-x------ 1 root root 64 Jul 3 17:07 9 -> pipe:[29209917]
Step 3
$ fgrep 29209894 /proc/2481/net/tcp
8: 0101A8C0:0016 0201A8C0:B0B0 ...
here fgrep uses the number on the socked and the PID to extract the information.
The important information is 0101A8C0:0016 and 0201A8C0:B0B0. The first relates to ther server and the second is the connected client where the first part (split by the colon) is the hexadecimal representation of the reversed IP address and the second is the hexadecimal representation of the port. i.e
0101A8C0 -> 1.1.168.192 -> 192.168.1.1. If you know the port the server is listening on you can skip Step 2 and use the following instead of Step 3.
Step 2 + 3 Replacement when knowing the server port - if no root is availalble
in this case as I was checking for SFTP connections on the standard ssh port of 22 (in hex 0016)
$ fgrep 0016 /proc/2481/net/tcp
8: 0101A8C0:0016 0201A8C0:B0B0 ...

Resources