[ClusterLabs Developers] performance problems with ocf resource nfsserver script

Eberhard Kuemmerle E.Kuemmerle at fz-juelich.de
Wed Sep 11 06:22:43 EDT 2019


Hi,

I use pacemaker with a some years old hardware.
In combination with an rsync backup, I had nfsserver monitoring timeouts that resulted in stonith fencing events...

So I tested the ocf resource nfsserver script and found, that even in an idle situation (without rsync or other heavy load),
'nfsserver monitor' was running for more than 10 seconds.

I found two critical actions in the script:
- systemctl status nfs-server  (which also calls journalctl)
- systemctl list-unit-files

So I modified the script and replaced

systemctl $cmd $svc
by
systemctl -n0 $cmd $svc
in nfs_exec() to suppress the journalctl call

and

systemctl list-unit-files
by
systemctl list-unit-files 'nfs-*'
and
systemctl list-unit-files 'rpc-*'

That reduced the runtime for 'nfsserver monitor' to less than 0.2 secons!

So I strongly recommend to integrate that modification in your repository.

Best regards,
  Eberhard

Here are the changes in detail:

diff -Naur /usr/lib/ocf/resource.d/heartbeat/nfsserver.orig /usr/lib/ocf/resource.d/heartbeat/nfsserver.mod
--- /usr/lib/ocf/resource.d/heartbeat/nfsserver.orig    2019-07-22 10:12:27.000000000 +0200
+++ /usr/lib/ocf/resource.d/heartbeat/nfsserver.mod     2019-09-11 09:05:25.985824119 +0200
@@ -233,24 +233,25 @@
                return 0
        fi
 
-       ##
-       # Attempt systemd (with nfs-lock.service).
-       ##
        if which systemctl > /dev/null 2>&1; then
-               if systemctl list-unit-files | grep nfs-server > /dev/null && systemctl list-unit-files | grep nfs-lock > /dev/null; then
-                       EXEC_MODE=2
-                       # when using systemd, the nfs-lock service file handles nfsv3 locking daemons for us.
-                       return 0
-               fi
-       fi
+               if systemctl list-unit-files 'nfs-*' | grep nfs-server > /dev/null; then
 
-       ##
-       # Attempt systemd (with rpc-statd.service).
-       ##
-       if which systemctl > /dev/null 2>&1; then
-               if systemctl list-unit-files | grep nfs-server > /dev/null && systemctl list-unit-files | grep rpc-statd > /dev/null; then
-                       EXEC_MODE=3
-                       return 0
+                       ##
+                       # Attempt systemd (with nfs-lock.service).
+                       ##
+                       if systemctl list-unit-files 'nfs-*' | grep nfs-lock > /dev/null; then
+                               EXEC_MODE=2
+                               # when using systemd, the nfs-lock service file handles nfsv3 locking daemons for us.
+                               return 0
+                       fi
+
+                       ##
+                       # Attempt systemd (with rpc-statd.service).
+                       ##
+                       if systemctl list-unit-files 'rpc-*' | grep rpc-statd > /dev/null; then
+                               EXEC_MODE=3
+                               return 0
+                       fi
                fi
        fi
 
@@ -272,12 +273,12 @@
                2) if ! echo $svc | grep -q "\."; then
                        svc="${svc}.service"
                   fi
-                  systemctl $cmd $svc
+                  systemctl -n0 $cmd $svc
                   ;;
                3) if ! echo $svc | grep -q "\."; then
                        svc="${svc}.service"
                   fi
-                  systemctl $cmd $svc
+                  systemctl -n0 $cmd $svc
                   ;;
        esac
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5346 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.clusterlabs.org/pipermail/developers/attachments/20190911/24dd3610/attachment.p7s>


More information about the Developers mailing list