On Fri, 31 Aug 2012, 刘硕 wrote:
Date: Fri, 31 Aug 2012 02:14:23
From: 刘硕 <[email protected]>
Cc: opendnssec-user <[email protected]>
To: Jerry Lundstr鰉 <[email protected]>
Subject: [Opendnssec-user]How to speed up signing performance
Hi Jerry,
>The CPU usage you see is normal since the Signer is threaded it will use more then 100% CPU (this really depends on how the OS reports
CPU usage).
>If you wish to lower the CPU usage you can configure the number of Worker and Signer threads in conf.xml for the Signer but then the s
igning will
>also take more time. Same goes if you wish to optimize/speed up the signing, reconfigure Worker and Signer threads to about 2x the num
ber of virtual
>CPUs you have (if you have 4 cores with hyper threading you will have 8 virtual CPUs).
# cat /proc/cpuinfo| grep processor | wc -l
24
As you said before, if our server has 24 processors, for a better signing
performance, the worker threads should be 24*2 and keep signer
threads equal with worker threads, right?
We use the attached two patches to speed up the signerd. For us it seems
mostly related to locking issues.
Paul
diff -Naur opendnssec-1.4.0a3-orig/signer/src/daemon/worker.c
opendnssec-1.4.0a3/signer/src/daemon/worker.c
--- opendnssec-1.4.0a3-orig/signer/src/daemon/worker.c 2012-08-02
16:57:01.000000000 -0400
+++ opendnssec-1.4.0a3/signer/src/daemon/worker.c 2012-08-20
15:41:34.665175565 -0400
@@ -173,7 +173,11 @@
* lets take a small break to not hog CPU.
*/
if (status == ODS_STATUS_UNCHANGED) {
+#if 0
worker_wait_timeout_locked(&q->q_lock, &q->q_nonfull, 60);
+#else
+ worker_wait_timeout_locked(&q->q_lock, &q->q_nonfull, 5);
+#endif
}
lock_basic_unlock(&q->q_lock);
}
Modified: trunk/OpenDNSSEC/signer/src/signer/namedb.c
===================================================================
- --- trunk/OpenDNSSEC/signer/src/signer/namedb.c 2012-08-09 09:36:35
UTC (rev 6514)
+++ trunk/OpenDNSSEC/signer/src/signer/namedb.c 2012-08-09 14:19:56
UTC (rev 6515)
@@ -215,9 +215,11 @@
} else if (ods_strcmp(format, "datecounter") == 0) {
soa = (uint32_t) time_datestamp(0, "%Y%m%d", NULL) * 100;
if (!util_serial_gt(soa, prev)) {
- - ods_log_warning("[%s] unable to use datecounter as serial: %u "
- - "does not increase %u. Serial set to %u", db_str, soa, prev,
- - (prev+1));
+ if (!db->is_initialized) {
+ ods_log_warning("[%s] unable to use datecounter as serial: %u "
+ "does not increase %u. Serial set to %u", db_str, soa,
prev,
+ (prev+1));
+ }
soa = prev + 1;
}
} else if (ods_strcmp(format, "counter") == 0) {
Modified: trunk/OpenDNSSEC/signer/src/signer/tools.c
===================================================================
- --- trunk/OpenDNSSEC/signer/src/signer/tools.c 2012-08-09 09:36:35 UTC
(rev 6514)
+++ trunk/OpenDNSSEC/signer/src/signer/tools.c 2012-08-09 14:19:56 UTC
(rev 6515)
@@ -39,6 +39,7 @@
#include "signer/tools.h"
#include "signer/zone.h"
+#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -213,7 +214,7 @@
/* kick the nameserver */
if (zone->notify_ns) {
int status;
- - pid_t pid;
+ pid_t pid, wpid;
ods_log_verbose("[%s] notify nameserver: %s", tools_str,
zone->notify_ns);
/** fork */
@@ -236,9 +237,20 @@
ods_log_debug("[%s] notify nameserver process forked",
tools_str);
/** wait for completion */
- - while (wait(&status) != pid) {
- - ;
+ while((wpid = waitpid(pid, &status, 0)) <= 0) {
+ if (errno != EINTR) {
+ break;
+ }
}
+ if (wpid == -1) {
+ ods_log_error("[%s] notify nameserver failed: waitpid() ",
+ "failed (%s)", tools_str, strerror(errno));
+ } else if (!WIFEXITED(status)) {
+ ods_log_error("[%s] notify nameserver failed: notify ",
+ "command did not terminate normally", tools_str);
+ } else {
+ ods_log_verbose("[%s] notify nameserver ok", tools_str);
+ }
break;
}
}
_______________________________________________
Opendnssec-user mailing list
[email protected]
https://lists.opendnssec.org/mailman/listinfo/opendnssec-user