Skip to content
Snippets Groups Projects
Commit 2c7f3570 authored by Moe Jette's avatar Moe Jette
Browse files

Decrease number of node re-registrations requests from the number of

RPC server threads to that number - 2. This should slightly reduce the
incomming RPC load.
parent 27a4f044
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
/* Request that nodes re-register at most every MAX_REG_FREQUENCY pings */ /* Request that nodes re-register at most every MAX_REG_FREQUENCY pings */
#define MAX_REG_FREQUENCY 20 #define MAX_REG_FREQUENCY 20
/* Spawn no more than MAX_REG_THREADS for node re-registration */
#define MAX_REG_THREADS (MAX_SERVER_THREADS - 2)
static pthread_mutex_t lock_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock_mutex = PTHREAD_MUTEX_INITIALIZER;
static int ping_count = 0; static int ping_count = 0;
...@@ -125,9 +128,9 @@ void ping_nodes (void) ...@@ -125,9 +128,9 @@ void ping_nodes (void)
reg_agent_args->retry = 0; reg_agent_args->retry = 0;
now = time (NULL); now = time (NULL);
offset += MAX_SERVER_THREADS; offset += MAX_REG_THREADS;
if ((offset > node_record_count) && if ((offset > node_record_count) &&
(offset >= (MAX_SERVER_THREADS * MAX_REG_FREQUENCY))) (offset >= (MAX_REG_THREADS * MAX_REG_FREQUENCY)))
offset = 0; offset = 0;
for (i = 0; i < node_record_count; i++) { for (i = 0; i < node_record_count; i++) {
...@@ -161,7 +164,7 @@ void ping_nodes (void) ...@@ -161,7 +164,7 @@ void ping_nodes (void)
* once in a while). We limit these requests since they * once in a while). We limit these requests since they
* can generate a flood of incomming RPCs. */ * can generate a flood of incomming RPCs. */
if ((base_state == NODE_STATE_UNKNOWN) || if ((base_state == NODE_STATE_UNKNOWN) ||
((i >= offset) && (i < (offset + MAX_SERVER_THREADS)))) { ((i >= offset) && (i < (offset + MAX_REG_THREADS)))) {
debug3 ("attempt to register %s now", debug3 ("attempt to register %s now",
node_record_table_ptr[i].name); node_record_table_ptr[i].name);
if ((reg_agent_args->node_count+1) > if ((reg_agent_args->node_count+1) >
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment