Poor performances with nfs and Kernel 3.x
Hello,
I'm writing about poor performances accessing a dm-crypt/LUKS partition using nfs.
I was running a fileserver Ubuntu_Server_11.04 (Kernel 2.6.38-13#52) with no problem.
But after an upgrade to Ubuntu_Server_11.10 (Kernel 3.0.0-15#26) reading and writing a crypted partition with nfs is very slow.
I've made different tests with a 2GB file to show the difference when the server is running a 2.6 or 3.0 kernel. All others parameters are always the same.
First, a test using nfs to access a crypted partition (dm-crypt/LUKS/ext4) on the server:
*Svr Kernel 3.0.0-15#26 : NFS (R/W) = 30 MB/s / 33 MB/s <-------- The problem is here ! *Svr Kernel 2.6.38-13#52 : NFS (R/W) = 81 MB/s / 53 MB/s
As you can see, with the Kernel 3.0, performances are very bad. The flow is always constant at ~30MB; there's clearly a limitation
For comparison, the same test, but this time, using nfs to read and write a non-crypted partition (ext4) (same HD of the crypted partition):
*Svr Kernel 3.0.0-15#26 : NFS (R/W) = 92 MB/s / 77 MB/s
*Svr Kernel 2.6.38-13#52 : NFS (R/W) = 111 MB/s / 74 MB/s
Using nfs without dm_crypt, performances are good with the 2 Kernels
Is dm_crypt module the problem ?
Following, a test without nfs, copying the 2GB file using a 2nd HD on the server from/to the crypted partition:
*Svr Kernel 3.0.0-15#26 : cp (from/to) the crypted partition = 64 MB/s / 57 MB/s
*Svr Kernel 2.6.38-13#52 : cp (from/to) the crypted partition = 61 MB/s / 60 MB/s
Using dm_crypt without nfs, there's no difference between the 2 Kernels
Apparently, there is a bad interaction between nfs and dm_crypt only with a 3.0 Kernel ?
What king of change has been made in the Kernel 3.x branch ?
Do you think that the dm_crypt module is involved ? Or perhaps it's a mapper/buffer problem ?
nfs seems to work correctly: no paquets are lost during transfers (I'm using default parameters, except for exportfs: async option instead of sync) Unfortunately, I'm just an user and my knowledge is limited, especially with dm_crypt and device_mapper.
Perhaps you can help me with this part ?
Feel free to ask more informations / tests.
Regards,
Mickael
Note:
- I've build other servers with a debian Wheezy (Kernel 3.1.0-1) and a Fedora 16 (Kernel 3.2.1-3). Both obtained the same results.
- Following, hardware/software informations about my system:
* Kernel version (from /proc/version):
Linux version 3.0.0-15-server (buildd@crested) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #26-Ubuntu SMP Fri Jan 20 19:07:39 UTC 2012
* Environment (Server)
CPU AMD Athlon64 3500+ (1core)
1GB RAM
mobo Asus A8N nForce4
eth 1GB nForce4
HD WD 2To Green (sata_nv)
:~$ cryptsetup luksDump /dev/sda1 Version: 1 Cipher name: aes Cipher mode: cbc-essiv:sha256 Hash spec: sha1 Payload offset: 2056 MK bits: 256
:~$ mkfs.ext4 /dev/mapper/crypted -m 0.2
:~$ exportfs -v /mnt/crypted 192.168.0.1(rw,async,wdelay,no_root_squash,no_subtree_check)
:~$ cat /proc/mount (server) /dev/mapper/crypted /mnt/crypted ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
:~$ cat /proc/mount (client) nfsd /proc/fs/nfsd nfsd rw,relatime 0 0 192.168.0.10:/mnt/crypted/ /mnt/crypted nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.1,minorversion=0,local_lock=none,addr=192.168.0.10 0 0
:~$ nfsiostat (after reading and writing a 2GB file) 192.168.0.10:/mnt/crypted/ mounted on /mnt/crypted: op/s rpc bklog 1432.16 0.88 read: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 32.037 4108.500 128.242 0 (0.0%) 66.974 94.895 write: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 47.713 4116.645 86.280 0 (0.0%) 27.833 1814.244
192.168.0.10:/mnt/sda2/ mounted on /mnt/sda2: (sda2 -> ext4 not crypted partition) op/s rpc bklog
9417.74 5.37
read: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 199.295 25502.509 127.964 0 (0.0%) 16.920 22.618 write: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 329.141 25555.419 77.643 0 (0.0%) 3.888 507.813
:~$ cat /proc/fs/nfsd export_features: 0x17e3f 0xf exports: /mnt/crypted 192.168.0.1(rw,no_root_squash,async,wdelay,no_subtree_check) max_block_size: 131072 nfsv4gracetime: 90 nfsv4leasetime: 90 nfsv4recoverydir: /var/lib/nfs/v4recovery pool_stats: 0 350070842 335513464 11979013 24 pool_threads: 8 portlist: udp/tcp=2049 supported_krb5_enctypes: 18,17,16,23,3,1,2 threads: 8 versions: +2 +3 +4 +4.1
:~$ cat /sys/kernel/slab/dm_crypt_io/ aliases : [0] align : [8] alloc_calls : [] cache_dma : [0] cpu_slabs : [1 N0=1] ctor : [] destroy_by_rcu : [0] free_calls : [] hwcache_align : [0] min_partial : [7] objects : [26 N0=26] object_size : [152] objects_partial : [0] objs_per_slab : [26] order : [0] partial : [0] poison : [0] reclaim_account : [0] red_zone : [0] remote_node_defrag_ratio : [100] reserved : [0] sanity_checks : [0] shrink : [] slabs : [1 N0=1] slab_size : [152] store_user : [0] total_objects : [26 N0=26] trace : [0] validate : []
Quoted 9 lines · Mickael
Hello,
I'm writing about poor performances accessing a dm-crypt/LUKS partition using nfs.
I was running a fileserver Ubuntu_Server_11.04 (Kernel 2.6.38-13#52) with no problem. But after an upgrade to Ubuntu_Server_11.10 (Kernel 3.0.0-15#26) reading and writing a crypted partition with nfs is very slow.
Interesting. I think have no issues here with Debian stable and Kernel 3.2.2 on the server and 3.1.6 on the client.
What is the kernel version on your client?
3.0.0 is not a very good kernel though with a number of issues. There is also a local privilege excalation in 3.x that has been fixed only in 3.2.2 and later. (Unless Ubuntu did it.)
Quoted 5 lines
I've made different tests with a 2GB file to show the difference when the server is running a 2.6 or 3.0 kernel. All others parameters are always the same.
Quoted 8 lines
First, a test using nfs to access a crypted partition (dm-crypt/LUKS/ext4) on the server:
*Svr Kernel 3.0.0-15#26? : NFS (R/W) = 30 MB/s / 33 MB/s?? <-------- The problem is here ! *Svr Kernel 2.6.38-13#52 : NFS (R/W) = 81 MB/s / 53 MB/s
As you can see, with the Kernel 3.0, performances are very bad. The flow is always constant at ~30MB; there's clearly a limitation
What did you use to do the benchmark?
Quoted 6 lines
For comparison, the same test, but this time, using nfs to read and write a non-crypted partition (ext4) (same HD of the crypted partition):
*Svr Kernel 3.0.0-15#26? : NFS (R/W) = 92 MB/s / 77 MB/s *Svr Kernel 2.6.38-13#52 : NFS (R/W) = 111 MB/s / 74 MB/s Using nfs without
dm_crypt, performances are good with the 2 Kernels
Interesting.
I will do a benchmark here and see whether I have the same.
Arno
Quoted 136 lines
Is
dm_cryptmodule the problem ? Following, a test without nfs, copying the 2GB file using a 2nd HD on the server from/to the crypted partition:*Svr Kernel 3.0.0-15#26? : cp (from/to) the crypted partition = 64 MB/s / 57 MB/s *Svr Kernel 2.6.38-13#52 : cp (from/to) the crypted partition = 61 MB/s / 60 MB/s Using
dm_cryptwithout nfs, there's no difference between the 2 KernelsApparently, there is a bad interaction between nfs and
dm_cryptonly with a 3.0 Kernel ?What king of change has been made in the Kernel 3.x branch ?
Do you think that the
dm_cryptmodule is involved ? Or perhaps it's a mapper/buffer problem ? nfs seems to work correctly: no paquets are lost during transfers (I'm using default parameters, except for exportfs: async option instead of sync) Unfortunately, I'm just an user and my knowledge is limited, especially withdm_cryptanddevice_mapper. Perhaps you can help me with this part ?Feel free to ask more informations / tests.
Regards,
MickaelNote:
- I've build other servers with a debian Wheezy (Kernel 3.1.0-1) and a Fedora 16 (Kernel 3.2.1-3). Both obtained the same results.- Following, hardware/software informations about my system:
* Kernel version (from
/proc/version):
Linux version 3.0.0-15-server (buildd@crested) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #26-Ubuntu SMP Fri Jan 20 19:07:39 UTC 2012* Environment (Server)
CPU AMD Athlon64 3500+ (1core)
1GB RAM
mobo Asus A8N nForce4
eth 1GB nForce4
HD WD 2To Green (sata_nv):~$ cryptsetup luksDump /dev/sda1 Version:?????? ??? 1 Cipher name:?? ??? aes Cipher mode:?? ??? cbc-essiv:sha256 Hash spec:???? ??? sha1 Payload offset:??? 2056 MK bits:?????? ??? 256:~$ mkfs.ext4 /dev/mapper/crypted -m 0.2:~$ exportfs -v /mnt/crypted???? ??? 192.168.0.1(rw,async,wdelay,no_root_squash,no_subtree_check):~$ cat /proc/mount (server) /dev/mapper/crypted /mnt/crypted ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0:~$ cat /proc/mount (client) nfsd /proc/fs/nfsd nfsd rw,relatime 0 0 192.168.0.10:/mnt/crypted/ /mnt/crypted nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.1,minorversion=0,local_lock=none,addr=192.168.0.10 0 0:~$ nfsiostat (after reading and writing a 2GB file) 192.168.0.10:/mnt/crypted/ mounted on /mnt/crypted: ?? op/s??? ??? rpc bklog 1432.16 ??? ?? 0.88 read:???????????? ops/s??? ??? ?? kB/s??? ??? ? kB/op??? ??? retrans??? ??? avg RTT (ms)??? avg exe (ms) ??? ??? ?32.037 ??? 4108.500 ??? 128.242??????? 0 (0.0%) ??? ?66.974 ??? ?94.895 write:??????????? ops/s??? ??? ?? kB/s??? ??? ? kB/op??? ??? retrans??? ??? avg RTT (ms)??? avg exe (ms) ??? ??? ?47.713 ??? 4116.645 ??? ?86.280??????? 0 (0.0%) ??? ?27.833 ??? 1814.244192.168.0.10:/mnt/sda2/ mounted on
/mnt/sda2:? (sda2 -> ext4 not crypted partition)
?? op/s??? ??? rpc bklog
9417.74 ??? ?? 5.37
read:???????????? ops/s??? ??? ?? kB/s??? ??? ? kB/op??? ??? retrans??? ??? avg RTT (ms)??? avg exe (ms) ??? ??? 199.295 ??? 25502.509 ??? 127.964??????? 0 (0.0%) ??? ?16.920 ??? ?22.618 write:??????????? ops/s??? ??? ?? kB/s??? ??? ? kB/op??? ??? retrans??? ??? avg RTT (ms)??? avg exe (ms) ??? ??? 329.141 ??? 25555.419 ??? ?77.643??????? 0 (0.0%) ??? ? 3.888 ??? 507.813:~$ cat /proc/fs/nfsd export_features:??? 0x17e3f 0xf exports:??? /mnt/crypted??? 192.168.0.1(rw,no_root_squash,async,wdelay,no_subtree_check) max_block_size:??? 131072 nfsv4gracetime:??? 90 nfsv4leasetime:??? ??? 90 nfsv4recoverydir:??? /var/lib/nfs/v4recovery pool_stats:??? 0 350070842 335513464 11979013 24 pool_threads:??? 8 portlist:??? udp/tcp=2049 supported_krb5_enctypes:??? 18,17,16,23,3,1,2 threads:??? 8 versions:??? +2 +3 +4 +4.1:~$ cat /sys/kernel/slab/dm_crypt_io/ aliases : [0] align : [8] alloc_calls : [] cache_dma : [0] cpu_slabs : [1 N0=1] ctor : [] destroy_by_rcu : [0] free_calls : [] hwcache_align : [0] min_partial : [7] objects : [26 N0=26] object_size : [152] objects_partial : [0] objs_per_slab : [26] order : [0] partial : [0] poison : [0] reclaim_account : [0] red_zone : [0] remote_node_defrag_ratio : [100] reserved : [0] sanity_checks : [0] shrink : [] slabs : [1 N0=1] slab_size : [152] store_user : [0] total_objects : [26 N0=26] trace : [0] validate : [] _______________________________________________ dm-crypt mailing list [email protected] http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
O.k., no such obervation with 3.2.2 on client and server. I got
root /gate/tmp>cat ttt | wcs > /dev/null
read: 2.147 GB [ 2147483648 B] avg: 69.274 MB/sec [ 31 sec]
(wcs, a.k.a. wc-stream is a small tool I wrote to do real-time monitoring of pipeline throughput and byte count, sources below.) This is with some ramp-up and almost 100% CPU load on the (slower) server.
I noticed though that nfsiostat is not the right tool to measure, as it gives you performance over the whole time the device has been mounted, i.e. the throughput number keeps being updated in real-time.
Maybe re-run with wcs as shown above (compile instructions are in the header of wcs.c) and also monitor CPU usage on the server while this is rrunning, e.g. with "top". I am not saying you imagine the issue, but lets be sure the measurement is good.
If you do not want to compile anything, you could also use something like "time cat ttt > /dev/null" and calculate throughput manually.
Arno
----- wcs.c -----
/* "wc-follow": wc with incremental output every second or so.
* Line positioning is done like in dd_rescue with
* "optimistic positioning" i.e. the hope that we have a terminal that
* understands vt100 positioning.
*
* (C) Arno Wagner <[email protected]> 2008. Distributed under
* The GNU public license v2
*
* Version 1.0
*
* Compile with "gcc -O6 -o wcs wcs.c"
*/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
const char* up = "\x1b[A"; //]
const char* down = "\n";
const char* right = "\x1b[C"; //]
char * usage() {
return("\n"
" Prints out running count and rate statistics about the data\n" " read on stdin to stderr. Does use cursor positioning, which\n" " should work on most terminals (vt100 or later).\n"
"\n"
" stdin is copied through to stdout, much like in tee.\n" " \n"
" This programm does not support any commandline arguments.\n" "\n"
"\n");
}
void printlong(long long l) {
if (l < 1000000L)
fprintf(stderr, "%7.3f kB", l/1000.0);
else if (l < 1000000000)
fprintf(stderr, "%7.3f MB", l/1000000.0);
else if (l < 1000000000000LL)
fprintf(stderr, "%7.3f GB", l/1000000000.0);
else
fprintf(stderr, "%7.3f TB", l/1000000000000.0);
} int main(int argc, char ** argv) {
char buf[4096];
long long cnt = 0;
time_t to, tn, ts, dt;
int read_count;
double rate;
if (argc > 1) {
fprintf(stderr, "%s", usage());
exit(1);
}
to = time(NULL);
ts = to;
fprintf(stderr, down);
while (1) {
read_count = read (0, buf, sizeof(buf));
if (read_count < 0 && errno == EINTR) continue; // not an error
if (read_count < 0) {
perror("Abnormal condition in read from stdin:");
exit(1);
} if (read_count > 0) {
cnt += read_count;
if (fwrite (buf, 1, read_count, stdout) != read_count) {
perror("Error in wcs writing to stdout:");
exit(1);
}
}
tn = time(NULL);
if (tn != to || read_count == 0) {
to = tn;
fprintf(stderr, "%s read: ", up);
printlong(cnt);
fprintf(stderr, " [ %12Ld B] avg: ", cnt);
// Calculate the rate
dt = tn - ts;
rate = cnt / (double)dt;
printlong((long long) rate);
fprintf(stderr, "/sec [ %5d sec]%s", dt, down);
}
if (read_count == 0) break; // we are done }
fprintf(stderr, "\n");
}
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
Quoted 16 lines
À : [email protected]
Cc :
Envoyé le : Mardi 7 février 2012 9h11
Objet : Re: [dm-crypt] Poor performances with nfs and Kernel 3.xQuoted 9 lines · Mickael
Hello,
I'm writing about poor performances accessing a dm-crypt/LUKS partition using nfs.
I was running a fileserver Ubuntu_Server_11.04 (Kernel 2.6.38-13#52) with no problem. But after an upgrade to Ubuntu_Server_11.10 (Kernel 3.0.0-15#26) reading and writing a crypted partition with nfs is very slow.
Quoted 4 lines
Interesting. I think have no issues here with Debian stable and Kernel 3.2.2 on the server and 3.1.6 on the client.
What is the kernel version on your client?
My client is an Unbutu 3.0.0-15#26 amd64 (2 CPU) Results are the same, using a 2.6 or 3.0 Kernel on the client. The problem seems to be located on the server only
Quoted 3 lines
3.0.0 is not a very good kernel though with a number of issues. There is also a local privilege excalation in 3.x that has been fixed only in 3.2.2 and later. (Unless Ubuntu did it.)
I've build a Fedora 16 (3.2.1-3) with no change
I need to find a distro with a recent Kernel (>3.2.2) to test if it solve the problem
Quoted 9 lines
Quoted 9 lines
I've made different tests with a 2GB file to show the difference when the server is running a 2.6 or 3.0 kernel. All others parameters are always the same.
First, a test using nfs to access a crypted partition (dm-crypt/LUKS/ext4) on the server:
Quoted 7 lines
Quoted 5 lines
*Svr Kernel 3.0.0-15#26? : NFS (R/W) = 30 MB/s / 33 MB/s?? <-------- The problem is here ! *Svr Kernel 2.6.38-13#52 : NFS (R/W) = 81 MB/s / 53 MB/s
As you can see, with the Kernel 3.0, performances are very bad. The flow is always constant at ~30MB; there's clearly a limitation
What did you use to do the benchmark?
Just coying a 2GB avi file with
time cp /tmp/testfile.avi /mnt/CRYPT/
and calculate the average speed (2000MB/time_sec)
Quoted 8 lines
Quoted 7 lines
For comparison, the same test, but this time, using nfs to read and write a non-crypted partition (ext4) (same HD of the crypted partition):
*Svr Kernel 3.0.0-15#26? : NFS (R/W) = 92 MB/s / 77 MB/s *Svr Kernel 2.6.38-13#52 : NFS (R/W) = 111 MB/s / 74 MB/s Using nfs without
dm_crypt, performances are good with the 2 Kernels
Quoted 19 lines
Interesting.
I will do a benchmark here and see whether I have the same.
Arno
------ Cut ------
Signature · 10 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell _______________________________________________ dm-crypt mailing list [email protected] http://www.saout.de/mailman/listinfo/dm-crypt
De : Arno Wagner <[email protected]>
Quoted 26 lines
De : Arno Wagner <[email protected]>
À : [email protected]
Cc :
Envoyé le : Mardi 7 février 2012 9h33
Objet : Re: [dm-crypt] Poor performances with nfs and Kernel 3.xO.k., no such obervation with 3.2.2 on client and server. I got
root /gate/tmp>cat ttt | wcs >
/dev/null
read: 2.147 GB [ 2147483648 B] avg: 69.274 MB/sec [ 31 sec](wcs, a.k.a. wc-stream is a small tool I wrote to do real-time monitoring of pipeline throughput and byte count, sources below.) This is with some ramp-up and almost 100% CPU load on the (slower) server.
I noticed though that nfsiostat is not the right tool to measure, as it gives you performance over the whole time the device has been mounted, i.e. the throughput number keeps being updated in real-time.
Maybe re-run with wcs as shown above (compile instructions are in the header of
wcs.c) and also monitor CPU usage on the server while this is rrunning, e.g. with "top". I am not saying you imagine the issue, but lets be sure the measurement is good.
Quoted 8 lines
If you do not want to compile anything, you could also use something like "time cat ttt >
/dev/null" and calculate throughput manually.Arno
----- CUTed -----
Hello Arno,
Here are the new tests with wcs: results are still the same.
/tmp is the tmp directory on the client (7200 rpm HD) /CRYPT is a crypted partition on the server (Green HD ~5600 rpm) /SAV is a non-crypted partition on the server (Green HD ~5600 rpm) CPU monitored with htop
*** Server with Kernel 3.0.0-15-server #26
* From client, using NFS on crypted partition:
cat /tmp/testfile.avi | wcs > /mnt/CRYPT/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 41.476 MB/sec [ 49 sec]
cat /mnt/CRYPT/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 29.454 MB/sec [ 69 sec] <---------------
-----------
* From client, using NFS on non-crypted partition
cat /tmp/testfile.avi | wcs > /mnt/SAV/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 72.583 MB/sec [ 28 sec]
cat /mnt/SAV/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 65.559 MB/sec [ 31 sec]
-----------
* From Server:
cat /mnt/CRYPT/testfile.avi | wcs > /dev/null
read: 2.032 GB [ 2032330895 B] avg: 72.583 MB/sec [ 28 sec]
cat /mnt/SAV/testfile.avi | wcs > /dev/null
read: 2.032 GB [ 2032330895 B] avg: 67.744 MB/sec [ 30 sec]
-----------
cat /mnt/CRYPT/testfile.avi | wcs > /mnt/SAV/testfile.avi read: 2.032 GB [ 2032330895 B] avg: 56.454 MB/sec [ 36 sec]
cat /mnt/SAV/testfile.avi | wcs > /mnt/CRYPT/testfile.avi read: 2.032 GB [ 2032330895 B] avg: 54.928 MB/sec [ 37 sec]
===============================
*** Server with Kernel 2.6.38-13-server #52
* From client, using NFS on crypted partition:
cat /tmp/testfile.avi | wcs > /mnt/CRYPT/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 54.928 MB/sec [ 37 sec] CPU=100%
cat /mnt/CRYPT/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 81.293 MB/sec [ 25 sec] CPU=98% <-------------------
-----------
* From client, using NFS on non-crypted partition
cat /tmp/testfile.avi | wcs > /mnt/SAV/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 63.510 MB/sec [ 32 sec] CPU=50%
cat /mnt/SAV/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 63.510 MB/sec [ 32 sec] CPU=25%
* From Server:
cat /mnt/CRYPT/testfile.avi | wcs > /dev/null
read: 2.032 GB [ 2032330895 B] avg: 84.680 MB/sec [ 24 sec] CPU=98%
cat /mnt/SAV/testfile.avi | wcs > /dev/null
read: 2.032 GB [ 2032330895 B] avg: 67.744 MB/sec [ 30 sec] CPU=25%
-----------
cat /mnt/CRYPT/testfile.avi | wcs > /mnt/SAV/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 52.111 MB/sec [ 39 sec] CPU=50%-100%
cat /mnt/SAV/testfile.avi | wcs > /mnt/CRYPT/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 47.264 MB/sec [ 43 sec] CPU=75%-100%
Have you looked at CPU load on the server? Maybe the difference is just the CPU-power that NFS consumes and decryption is already CPU-Limited before. The low non-encrypted performance, compared to local performance, is also a bit fishy.
Pure speculation, but maybe something is consuming CPU on the server or the CPU is slowed-down in some way. If this not a CPU-power issue, then the CPU should have significant idle percentage during encrypted accesses.
Arno
Quoted 130 lines · Mickael
Quoted 26 lines
De?: Arno Wagner <[email protected]>
??: [email protected]
Cc?:
Envoy? le : Mardi 7 f?vrier 2012 9h33
Objet?: Re: [dm-crypt] Poor performances with nfs and Kernel 3.xO.k., no such obervation with 3.2.2 on client and server. I got
root /gate/tmp>cat ttt | wcs >
/dev/null
read:? 2.147 GB [? 2147483648 B]? ? avg:? 69.274 MB/sec [? ? 31 sec](wcs, a.k.a. wc-stream is a small tool I wrote to do real-time monitoring of pipeline throughput and byte count, sources below.) This is with some ramp-up and almost 100% CPU load on the (slower) server.
I noticed though that nfsiostat is not the right tool to measure, as it gives you performance over the whole time the device has been mounted, i.e. the throughput number keeps being updated in real-time.
Maybe re-run with wcs as shown above (compile instructions are in the header of
wcs.c) and also monitor CPU usage on the server while this is rrunning, e.g. with "top". I am not saying you imagine the issue, but lets be sure the measurement is good.Quoted 8 lines
If you do not want to compile anything, you could also use something like "time cat ttt >
/dev/null" and calculate throughput manually.Arno
----- CUTed -----
Hello Arno,
Here are the new tests with wcs: results are still the same./tmp is the tmp directory on the client (7200 rpm HD) /CRYPT is a crypted partition on the server (Green HD ~5600 rpm) /SAV is a non-crypted partition on the server (Green HD ~5600 rpm) CPU monitored with htop
*** Server with Kernel 3.0.0-15-server #26
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 41.476 MB/sec [??? 49 sec]cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 29.454 MB/sec [??? 69 sec]??? <--------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 65.559 MB/sec [??? 31 sec]-----------
* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 56.454 MB/sec [??? 36 sec]cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]===============================
*** Server with Kernel 2.6.38-13-server #52
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]??? CPU=100%cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 81.293 MB/sec [??? 25 sec]??? CPU=98%??? ??? <------------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=50%cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=25%* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 84.680 MB/sec [??? 24 sec]??? CPU=98%cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]??? CPU=25%-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 52.111 MB/sec [??? 39 sec]??? CPU=50%-100%cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 47.264 MB/sec [??? 43 sec]??? CPU=75%-100%
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
Here are more tests focusing the CPU load with htop snapshot:
with Kernel 3.x, nfsd threads are using more CPU !?
Then kworker (process used for encryption) has less CPU time.
(The server is a simple fileserver using nfs, dm_crypt and ssh for administration.)
About the low non-encrypted performance; this is certainly due to AMD Kool&Quiet. As CPU load is low, the CPU frequency stay at its minimum value 1GHz during non-encrypted access. But when using encryption, the frequency is set to its maximum, 2.3GHz
*** KERNEL 2.6 ***
NFS Reading:
cat /mnt/CRYPT/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 81.293 MB/sec [ 25 sec]
CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 36, 68 kthr; 3 running Mem[||||||||||||||||||||||||||||||||||||||||||||81/998MB] Load average: 2.68 2.93 1.79
Swp[ 0/1951MB] Uptime: 00:20:20
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 41 root 20 0 0 0 0 R 84.0 0.0 2:05.48 kworker/0:1 1020 root 20 0 0 0 0 D 1.0 0.0 0:10.72 nfsd 1015 root 20 0 0 0 0 D 1.0 0.0 0:07.29 nfsd 1019 root 20 0 0 0 0 D 1.0 0.0 0:08.35 nfsd 1022 root 20 0 0 0 0 D 1.0 0.0 0:11.00 nfsd 1016 root 20 0 0 0 0 D 1.0 0.0 0:07.41 nfsd 1017 root 20 0 0 0 0 D 1.0 0.0 0:08.79 nfsd 1021 root 20 0 0 0 0 D 1.0 0.0 0:08.41 nfsd 42 root 20 0 0 0 0 S 1.0 0.0 0:06.89 kswapd0 1018 root 20 0 0 0 0 D 1.0 0.0 0:11.10 nfsd 1460 root 20 0 0 0 0 R 0.0 0.0 0:01.34 kworker/0:0 1475 root 20 0 21972 1556 1148 R 0.0 0.2 0:01.79 htop 1 root 20 0 24188 2088 1168 S 0.0 0.2 0:00.48 /sbin/init
----------
NFS Writing:
cat testfile.avi | wcs > /mnt/CRYPT/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 50.808 MB/sec [ 40 sec]
CPU[||||||||||||||||||||||||||||||||| 61.8%] Tasks: 36, 68 kthr; 2 running Mem[|||||||||||||||||||||||| 86/998MB] Load average: 3.35 2.32 1.81
Swp[ 0/1951MB] Uptime: 00:27:15
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 41 root 20 0 0 0 0 S 41.0 0.0 3:21.84 kworker/0:1 1015 root 20 0 0 0 0 S 9.0 0.0 0:09.85 nfsd 1020 root 20 0 0 0 0 S 4.0 0.0 0:15.22 nfsd 1021 root 20 0 0 0 0 S 2.0 0.0 0:11.35 nfsd 1018 root 20 0 0 0 0 R 1.0 0.0 0:15.18 nfsd 1460 root 20 0 0 0 0 S 0.0 0.0 0:02.39 kworker/0:0 1017 root 20 0 0 0 0 S 0.0 0.0 0:12.03 nfsd 1488 root 20 0 0 0 0 S 0.0 0.0 0:01.66 flush-251:3 1016 root 20 0 0 0 0 S 0.0 0.0 0:10.30 nfsd 1442 root 20 0 0 0 0 S 0.0 0.0 0:03.41 jbd2/dm-3-8 42 root 20 0 0 0 0 S 0.0 0.0 0:08.25 kswapd0 1022 root 20 0 0 0 0 S 0.0 0.0 0:14.34 nfsd 1019 root 20 0 0 0 0 S 0.0 0.0 0:11.05 nfsd 91 root 20 0 0 0 0 S 0.0 0.0 0:01.27 kworker/0:2 1 root 20 0 24188 2088 1168 S 0.0 0.2 0:00.48 /sbin/init
========================================
*** KERNEL 3.0 ***
NFS Reading:
cat /mnt/CRYPT/testfile.avi | wcs > /tmp/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 30.793 MB/sec [ 66 sec]
CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 36, 65 kthr; 3 running Mem[|||||||||||||||||||||||||||||||| 69/998MB] Load average: 2.02 0.47 0.16
Swp[ 0/1951MB] Uptime: 00:03:02
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 38 root 20 0 0 0 0 R 36.0 0.0 0:05.17 kworker/0:1 1045 root 20 0 0 0 0 R 36.0 0.0 0:03.07 nfsd 1046 root 20 0 0 0 0 D 3.0 0.0 0:02.23 nfsd 1049 root 20 0 0 0 0 D 3.0 0.0 0:00.52 nfsd 1044 root 20 0 0 0 0 D 3.0 0.0 0:00.70 nfsd 1047 root 20 0 0 0 0 D 3.0 0.0 0:00.54 nfsd 1042 root 20 0 0 0 0 D 3.0 0.0 0:00.51 nfsd 1043 root 20 0 0 0 0 D 3.0 0.0 0:00.49 nfsd 1048 root 20 0 0 0 0 D 3.0 0.0 0:00.50 nfsd 1446 root 20 0 21972 1552 1148 R 0.0 0.2 0:00.68 htop 1 root 20 0 24188 2188 1284 S 0.0 0.2 0:00.46 /sbin/init
----------
NFS Writing:
cat testfile.avi | wcs > /mnt/CRYPT/testfile.avi
read: 2.032 GB [ 2032330895 B] avg: 36.951 MB/sec [ 55 sec]
CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 36, 61 kthr; 3 running Mem[||||||||||||||||||||||||||||||| 83/998MB] Load average: 2.39 2.26 1.10
Swp[ 0/1951MB] Uptime: 00:07:27
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 38 root 20 0 0 0 0 R 49.0 0.0 0:52.87 kworker/0:1 1048 root 20 0 0 0 0 R 49.0 0.0 0:12.66 nfsd 1045 root 20 0 0 0 0 D 0.0 0.0 0:16.80 nfsd 1044 root 20 0 0 0 0 D 0.0 0.0 0:09.27 nfsd 1043 root 20 0 0 0 0 D 0.0 0.0 0:10.83 nfsd 1042 root 20 0 0 0 0 D 0.0 0.0 0:08.08 nfsd 1047 root 20 0 0 0 0 D 0.0 0.0 0:09.70 nfsd 1467 root 20 0 21972 1556 1152 R 0.0 0.2 0:00.36 htop 1 root 20 0 24188 2072 1168 S 0.0 0.2 0:00.46 /sbin/init
Quoted 153 lines
----- Mail original -----
De : Arno Wagner <[email protected]>
À : [email protected]
Cc :
Envoyé le : Mercredi 8 février 2012 16h26
Objet : Re: [dm-crypt] Re : Poor performances with nfs and Kernel 3.xHave you looked at CPU load on the server? Maybe the difference is just the CPU-power that NFS consumes and decryption is already CPU-Limited before. The low non-encrypted performance, compared to local performance, is also a bit fishy.
Pure speculation, but maybe something is consuming CPU on the server or the CPU is slowed-down in some way. If this not a CPU-power issue, then the CPU should have significant idle percentage during encrypted accesses.
Arno
Quoted 123 lines · Mickael
Quoted 26 lines
De?: Arno Wagner <[email protected]>
??: [email protected]
Cc?:
Envoy? le : Mardi 7 f?vrier 2012 9h33
Objet?: Re: [dm-crypt] Poor performances with nfs and Kernel 3.xO.k., no such obervation with 3.2.2 on client and server. I got
root /gate/tmp>cat ttt | wcs >
/dev/null
read:? 2.147 GB [? 2147483648 B]? ? avg:? 69.274 MB/sec [? ? 31 sec](wcs, a.k.a. wc-stream is a small tool I wrote to do real-time monitoring of pipeline throughput and byte count, sources below.) This is with some ramp-up and almost 100% CPU load on the (slower) server.
I noticed though that nfsiostat is not the right tool to measure, as it gives you performance over the whole time the device has been mounted, i.e. the throughput number keeps being updated in real-time.
Maybe re-run with wcs as shown above (compile instructions are in the header of
wcs.c) and also monitor CPU usage on the server while this is rrunning, e.g. with "top". I am not saying you imagine the issue, but lets be sure the measurement is good.Quoted 8 lines
If you do not want to compile anything, you could also use something like "time cat ttt >
/dev/null" and calculate throughput manually.Arno
----- CUTed -----
Hello Arno,
Here are the new tests with wcs: results are still the same./tmp is the tmp directory on the client (7200 rpm HD) /CRYPT is a crypted partition on the server (Green HD ~5600 rpm) /SAV is a non-crypted partition on the server (Green HD ~5600 rpm) CPU monitored with htop
*** Server with Kernel 3.0.0-15-server #26
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 41.476 MB/sec [??? 49 sec]cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 29.454 MB/sec [??? 69 sec]??? <--------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 65.559 MB/sec [??? 31 sec]-----------
* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 56.454 MB/sec [??? 36 sec]cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]===============================
*** Server with Kernel 2.6.38-13-server #52
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]??? CPU=100%cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 81.293 MB/sec [??? 25 sec]??? CPU=98%??? ??? <------------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=50%cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=25%* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 84.680 MB/sec [??? 24 sec]??? CPU=98%cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]??? CPU=25%-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 52.111 MB/sec [??? 39 sec]??? CPU=50%-100%Quoted 7 lines
cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 47.264 MB/sec [??? 43 sec]??? CPU=75%-100%
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Quoted 10 lines
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F
----
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
_______________________________________________
dm-crypt mailing list
[email protected]
Quoted 3 lines · Mickael
Here are more tests focusing the CPU load with htop snapshot:
with Kernel 3.x, nfsd threads are using more CPU !?
This is what I suspected. You setup is already slightly CPU-limited when reading/writing encrypted partitions. Any additional CPU needed by NFS is then directly deduced from CPU available for encryption.
I have to say this is a pretty special case as reading/writing must be CPU limited, but only just about.
I have no idea why NFSD needs more CPU though. Maybe add that as finding to your LKML post. Maybe also try to contact the NFS folks directly or via bugzilla.kernel.org by filing a bug against NFSD in 3.x.
Possible fixes:
1) live with it
2) stay with kernel 2.6.x
3) use a faster cipher (although AES is pretty optimal here)
4) get a faster CPU, or one with at least 2 cores if this is a single core.
Arno
Quoted 279 lines
Then kworker (process used for encryption) has less CPU time.
(The server is a simple fileserver using nfs,dm_cryptand ssh for administration.)About the low non-encrypted performance; this is certainly due to AMD Kool&Quiet. As CPU load is low, the CPU frequency stay at its minimum value 1GHz during non-encrypted access. But when using encryption, the frequency is set to its maximum, 2.3GHz
*** KERNEL 2.6 ***
NFS Reading:
cat/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 81.293 MB/sec [??? 25 sec]? CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%]???? Tasks: 36, 68 kthr; 3 running ? Mem[||||||||||||||||||||||||||||||||||||||||||||81/998MB]???? Load average: 2.68 2.93 1.79? Swp[??????????????????????????????????????????? 0/1951MB]???? Uptime: 00:20:20
? PID USER???? PRI? NI? VIRT?? RES?? SHR S CPU% MEM%?? TIME+? Command ?? 41 root????? 20?? 0???? 0???? 0???? 0 R 84.0? 0.0? 2:05.48 kworker/0:1 ?1020 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:10.72 nfsd ?1015 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:07.29 nfsd ?1019 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:08.35 nfsd ?1022 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:11.00 nfsd ?1016 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:07.41 nfsd ?1017 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:08.79 nfsd ?1021 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:08.41 nfsd ?? 42 root????? 20?? 0???? 0???? 0???? 0 S? 1.0? 0.0? 0:06.89 kswapd0 ?1018 root????? 20?? 0???? 0???? 0???? 0 D? 1.0? 0.0? 0:11.10 nfsd ?1460 root????? 20?? 0???? 0???? 0???? 0 R? 0.0? 0.0? 0:01.34 kworker/0:0 ?1475 root????? 20?? 0 21972? 1556? 1148 R? 0.0? 0.2? 0:01.79 htop ??? 1 root????? 20?? 0 24188? 2088? 1168 S? 0.0? 0.2? 0:00.48
/sbin/init----------
NFS Writing:
cat testfile.avi | wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 50.808 MB/sec [??? 40 sec]? CPU[|||||||||||||||||||||||||||||||||????????????? 61.8%]???? Tasks: 36, 68 kthr; 2 running ? Mem[||||||||||||||||||||||||??????????????????? 86/998MB]???? Load average: 3.35 2.32 1.81? Swp[??????????????????????????????????????????? 0/1951MB]???? Uptime: 00:27:15
? PID USER???? PRI? NI? VIRT?? RES?? SHR S CPU% MEM%?? TIME+? Command ?? 41 root????? 20?? 0???? 0???? 0???? 0 S 41.0? 0.0? 3:21.84 kworker/0:1 ?1015 root????? 20?? 0???? 0???? 0???? 0 S? 9.0? 0.0? 0:09.85 nfsd ?1020 root????? 20?? 0???? 0???? 0???? 0 S? 4.0? 0.0? 0:15.22 nfsd ?1021 root????? 20?? 0???? 0???? 0???? 0 S? 2.0? 0.0? 0:11.35 nfsd ?1018 root????? 20?? 0???? 0???? 0???? 0 R? 1.0? 0.0? 0:15.18 nfsd ?1460 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:02.39 kworker/0:0 ?1017 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:12.03 nfsd ?1488 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:01.66 flush-251:3 ?1016 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:10.30 nfsd ?1442 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:03.41 jbd2/dm-3-8 ?? 42 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:08.25 kswapd0 ?1022 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:14.34 nfsd ?1019 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:11.05 nfsd ?? 91 root????? 20?? 0???? 0???? 0???? 0 S? 0.0? 0.0? 0:01.27 kworker/0:2 ??? 1 root????? 20?? 0 24188? 2088? 1168 S? 0.0? 0.2? 0:00.48
/sbin/init========================================
*** KERNEL 3.0 ***
NFS Reading:
cat/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 30.793 MB/sec [??? 66 sec]? CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%]???? Tasks: 36, 65 kthr; 3 running ? Mem[||||||||||||||||||||||||||||||||??????????? 69/998MB]???? Load average: 2.02 0.47 0.16? Swp[??????????????????????????????????????????? 0/1951MB]???? Uptime: 00:03:02
? PID USER???? PRI? NI? VIRT?? RES?? SHR S CPU% MEM%?? TIME+? Command ?? 38 root????? 20?? 0???? 0???? 0???? 0 R 36.0? 0.0? 0:05.17 kworker/0:1 ?1045 root????? 20?? 0???? 0???? 0???? 0 R 36.0? 0.0? 0:03.07 nfsd ?1046 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:02.23 nfsd ?1049 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.52 nfsd ?1044 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.70 nfsd ?1047 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.54 nfsd ?1042 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.51 nfsd ?1043 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.49 nfsd ?1048 root????? 20?? 0???? 0???? 0???? 0 D? 3.0? 0.0? 0:00.50 nfsd ?1446 root????? 20?? 0 21972? 1552? 1148 R? 0.0? 0.2? 0:00.68 htop ??? 1 root????? 20?? 0 24188? 2188? 1284 S? 0.0? 0.2? 0:00.46
/sbin/init----------
NFS Writing:
cat testfile.avi | wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 36.951 MB/sec [??? 55 sec]? CPU[||||||||||||||||||||||||||||||||||||||||||||||100.0%]???? Tasks: 36, 61 kthr; 3 running ? Mem[|||||||||||||||||||||||||||||||???????????? 83/998MB]???? Load average: 2.39 2.26 1.10? Swp[??????????????????????????????????????????? 0/1951MB]???? Uptime: 00:07:27
? PID USER???? PRI? NI? VIRT?? RES?? SHR S CPU% MEM%?? TIME+? Command ?? 38 root????? 20?? 0???? 0???? 0???? 0 R 49.0? 0.0? 0:52.87 kworker/0:1 ?1048 root????? 20?? 0???? 0???? 0???? 0 R 49.0? 0.0? 0:12.66 nfsd ?1045 root????? 20?? 0???? 0???? 0???? 0 D? 0.0? 0.0? 0:16.80 nfsd ?1044 root????? 20?? 0???? 0???? 0???? 0 D? 0.0? 0.0? 0:09.27 nfsd ?1043 root????? 20?? 0???? 0???? 0???? 0 D? 0.0? 0.0? 0:10.83 nfsd ?1042 root????? 20?? 0???? 0???? 0???? 0 D? 0.0? 0.0? 0:08.08 nfsd ?1047 root????? 20?? 0???? 0???? 0???? 0 D? 0.0? 0.0? 0:09.70 nfsd ?1467 root????? 20?? 0 21972? 1556? 1152 R? 0.0? 0.2? 0:00.36 htop ??? 1 root????? 20?? 0 24188? 2072? 1168 S? 0.0? 0.2? 0:00.46
/sbin/initQuoted 153 lines
----- Mail original -----
De : Arno Wagner <[email protected]>
? : [email protected]
Cc :
Envoy? le : Mercredi 8 f?vrier 2012 16h26
Objet : Re: [dm-crypt] Re : Poor performances with nfs and Kernel 3.xHave you looked at CPU load on the server? Maybe the difference is just the CPU-power that NFS consumes and decryption is already CPU-Limited before. The low non-encrypted performance, compared to local performance, is also a bit fishy.
Pure speculation, but maybe something is consuming CPU on the server or the CPU is slowed-down in some way. If this not a CPU-power issue, then the CPU should have significant idle percentage during encrypted accesses.
Arno
Quoted 123 lines · Mickael
Quoted 26 lines
De?: Arno Wagner <[email protected]>
??: [email protected]
Cc?:
Envoy? le : Mardi 7 f?vrier 2012 9h33
Objet?: Re: [dm-crypt] Poor performances with nfs and Kernel 3.xO.k., no such obervation with 3.2.2 on client and server. I got
root /gate/tmp>cat ttt | wcs >
/dev/null
read:?? 2.147 GB [?? 2147483648 B]? ? avg:? 69.274 MB/sec [? ? 31 sec](wcs, a.k.a. wc-stream is a small tool I wrote to do real-time monitoring of pipeline throughput and byte count, sources below.) This is with some ramp-up and almost 100% CPU load on the (slower) server.
I noticed though that nfsiostat is not the right tool to measure, as it gives you performance over the whole time the device has been mounted, i.e. the throughput number keeps being updated in real-time.
Maybe re-run with wcs as shown above (compile instructions are in the header of
wcs.c) and also monitor CPU usage on the server while this is rrunning, e.g. with "top". I am not saying you imagine the issue, but lets be sure the measurement is good.Quoted 8 lines
If you do not want to compile anything, you could also use something like "time cat ttt >
/dev/null" and calculate throughput manually.Arno
----- CUTed -----
Hello Arno,
Here are the new tests with wcs: results are still the same./tmp is the tmp directory on the client (7200 rpm HD) /CRYPT is a crypted partition on the server (Green HD ~5600 rpm) /SAV is a non-crypted partition on the server (Green HD ~5600 rpm) CPU monitored with htop
*** Server with Kernel 3.0.0-15-server #26
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 41.476 MB/sec [??? 49 sec]cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 29.454 MB/sec [??? 69 sec]??? <--------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 65.559 MB/sec [??? 31 sec]-----------
* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 72.583 MB/sec [??? 28 sec]cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 56.454 MB/sec [??? 36 sec]cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]===============================
*** Server with Kernel 2.6.38-13-server #52
* From client, using NFS on crypted partition:
cat
/tmp/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 54.928 MB/sec [??? 37 sec]??? CPU=100%cat
/mnt/CRYPT/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 81.293 MB/sec [??? 25 sec]??? CPU=98%??? ??? <------------------------------
* From client, using NFS on non-crypted partition
cat
/tmp/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=50%cat
/mnt/SAV/testfile.avi| wcs >/tmp/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 63.510 MB/sec [??? 32 sec]??? CPU=25%* From Server:
cat
/mnt/CRYPT/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 84.680 MB/sec [??? 24 sec]??? CPU=98%cat
/mnt/SAV/testfile.avi| wcs >/dev/null
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 67.744 MB/sec [??? 30 sec]??? CPU=25%-----------
cat
/mnt/CRYPT/testfile.avi| wcs >/mnt/SAV/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 52.111 MB/sec [??? 39 sec]??? CPU=50%-100%Quoted 7 lines
cat
/mnt/SAV/testfile.avi| wcs >/mnt/CRYPT/testfile.avi
?read:?? 2.032 GB [?? 2032330895 B]??? avg:? 47.264 MB/sec [??? 43 sec]??? CPU=75%-100%
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-cryptQuoted 10 lines
--
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG:? ID: 1E25338F? FP: 0C30 5782 9D93 F785 E79C? 0296 797F 6B50 1E25 338F
----
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
_______________________________________________
dm-crypt mailing list
[email protected]http://www.saout.de/mailman/listinfo/dm-crypt
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
Quoted 3 lines · Arno Wagner
Possible fixes:
4) get a faster CPU, or one with at least 2 cores if this is a single core.
An AMD Bulldozer(AFAIR) or Intel Core i5 (of Westmere or newer generation, so Core i5 5xx, or Core i5/7 2xxx) or better would have AES-NI. Hardware Acceleration helps tremendously.
I have tested copying between a Core i7 2600 and a Core i5 560, i get 100MB/s either with NFS(v3) or via scp (with the intel-acceleration-engine for openssl, so openssl can use AES-NI which it doesn't "as is", altough i also get the necessary speed if i use "arcfour").
The Kernel i tested with was 3.2 on both sides.
I ran the test from HDD over Gigabit to tmpfs.
To be precise i have to say that i ran the test with loop-aes, but i expect i will get comparable speed after i switch to dm-crypt.
When i compared loop-aes to dm-crypt for raw-speed on a tmpfs i got more speed out of dm-crypt(cipher=aes:64-cbc-lmk)).
I got 360MB/s for loop-aes vs. 540 MB/s for dm-crypt. But loop-aes needed less cpu. 1 core with 100% for loop-aes vs. 1 core with 100% and 3 cores with 66% from dm-crypt.
As only about 20% of max-speed are needed for 100MB/s i think i would get about the same speed if i had used dm-crypt.
Bis denn
Signature · 4 lines
Real Programmers consider "what you see is what you get" to be just as bad a concept in Text Editors as it is in women. No, the Real Programmer wants a "you asked for it, you got it" text editor -- complicated, cryptic, powerful, unforgiving, dangerous.
Quoted 9 lines · Arno Wagner
Quoted 3 lines · Mickael
Here are more tests focusing the CPU load with htop snapshot:
with Kernel 3.x, nfsd threads are using more CPU !?
This is what I suspected. You setup is already slightly CPU-limited when reading/writing encrypted partitions. Any additional CPU needed by NFS is then directly deduced from CPU available for encryption.
Not sure if it help, but it would be interesting if you can try to use patch from this thread
http://article.gmane.org/gmane.linux.kernel/1245748
(it can be completely unrelated though, I have no time to test it now myself)
BTW I will add possibility to use null cipher to cryptsetup, just to test exactly these situations (null cipher eliminates all crypto operations), for now, you can try it with dmsetup and measure preformance (this should uncover if encryption is the problem or there is some timing problem):
(Replace DEV with your disk, note key is "-" - means empty)
dmsetup create x --table "0 $(blockdev --getsz DEV) crypt cipher_null-ecb-null - 0 DEV 0"
Milan
Quoted 15 lines · Milan Broz
Quoted 9 lines · Arno Wagner
Quoted 3 lines · Mickael
Here are more tests focusing the CPU load with htop snapshot:
with Kernel 3.x, nfsd threads are using more CPU !?
This is what I suspected. You setup is already slightly CPU-limited when reading/writing encrypted partitions. Any additional CPU needed by NFS is then directly deduced from CPU available for encryption.
Not sure if it help, but it would be interesting if you can try to use patch from this thread
http://article.gmane.org/gmane.linux.kernel/1245748
Quoted 6 lines
(it can be completely unrelated though, I have no time to test it now myself)
BTW I will add possibility to use null cipher to cryptsetup, just to test exactly these situations (null cipher eliminates all crypto operations),
That is a really good idea!
Arno
Quoted 14 lines
for now, you can try it with dmsetup and
measure preformance (this should uncover if encryption is the problem or there is some timing problem):(Replace DEV with your disk, note key is "-" - means empty)
dmsetup create x --table "0 $(blockdev --getsz DEV) crypt cipher_null-ecb-null - 0 DEV 0"
Milan
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell
Quoted 27 lines
----- Mail original -----
De : Arno Wagner <[email protected]>
À : [email protected]
Cc :
Envoyé le : Jeudi 9 février 2012 8h37
Objet : Re: [dm-crypt] Re : Re : Poor performances with nfs and Kernel 3.xQuoted 3 lines · Mickael
Here are more tests focusing the CPU load with htop snapshot:
with Kernel 3.x, nfsd threads are using more CPU !?
This is what I suspected. You setup is already slightly CPU-limited when reading/writing encrypted partitions. Any additional CPU needed by NFS is then directly deduced from CPU available for encryption.
I have to say this is a pretty special case as reading/writing must be CPU limited, but only just about.
I have no idea why NFSD needs more CPU though. Maybe add that as finding to your LKML post. Maybe also try to contact the NFS folks directly or via bugzilla.kernel.org by filing a bug against NFSD in 3.x.
Quoted 9 lines
Possible fixes:
1) live with it
2) stay with kernel 2.6.x
3) use a faster cipher (although AES is pretty optimal here)
4) get a faster CPU, or one with at least 2 cores if this is a single core.Arno
Sorry for the late answer.
I've finally compiled the last stable Kernel 3.2.7 this afternoon, and the problem is still here :(
There is an identical bug report on ubuntu launchpad ( https://bugs.launchpad.net/ubuntu/+source/nfs-utils/+bug/879334 ), but I'm not sure if Ubuntu is working on it. (Problem reported when Ubuntu started using 3.0 Kernel in october 2011) I need to take a look at the NFS mailing list to see if the problem has been reported. The solution is certainly here.
For the moment, I stay with the 2.6 Kernel !
Thanks for your help !
Mickael
PS: about point 3: Have you ever thinking adding an option to cryptsetup to do a benchmark like this: http://www.truecrypt.org/screenshots2 (I guess everyone build his own one) In fact, with the speed, it will be great to have an idea about the security level of each cipher too. But is it possible to calculate such index ? For example, is the slowest cipher the most secure ?
Quoted 1 line · Mickael
[...]
Quoted 7 lines
PS: about point 3: Have you ever thinking adding an option to cryptsetup to do a benchmark like this: http://www.truecrypt.org/screenshots2 (I guess everyone build his own one) In fact, with the speed, it will be great to have an idea about the security level of? each cipher too. But is it possible to calculate such index ? For example, is the slowest cipher the most secure ?
Unfortunately, no. Ciphers get broken overt time and at some point they become practiclly insecure, depending on attacker model. This means cipher security is always an expert opinion as not all people working on breaking a cipher will publish their results. Then there is another factor: If somebody can break a cipher, for what kind of informatin will they admit they can (by using that nformaton)? And to make matters more complicated, once somebody adits to being able to break a certain cipher, they may also use that capability for things of far lesser worth.
Cyrrent advice is to use AES for everything that needs to be secure. The other AES-finalists should also be pretty good and some may be more secure than AES in fact. Not that it matters at this time.
Also note that TrueCrypt ffers cobinaton of ciphers where (hopefully) all have to be broken to access the secrets. dm-crypt does not do that, byt you can manyally layer diffent ciphers if you want it.
Arno
Signature · 6 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] GnuPG: ID: 1E25338F FP: 0C30 5782 9D93 F785 E79C 0296 797F 6B50 1E25 338F ---- One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision. -- Bertrand Russell