You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scene description: An abnormal eureka client sends dozens of renew requests within 1s. As a result, the number of nodes in the eureka server cluster is inconsistent, and node information cannot be synchronized between the two servers.
Analyze:When nodes are synchronized in the eureka server cluster, a batchTaskDispatcher is created to package and send tasks in batches, and tasks are queued in the AcceptorExecutor.
If the renewal frequency of an application instance(eureka.instance.lease-renewal-interval-in-seconds) is smaller than the synchronization execution frequency(MAX_BATCHING_DELAY_MS=500), and the Task of the application instance is at the head of the pendingTasks to be processed, the registry server fails to determine whether the difference between the task creation time and the current time is smaller than the synchronization execution time. As a result, the registry server does not put the renewal task in the batchWorkQueue to be executed.
AcceptorExecutor.java:
void assignBatchWork() {
if (hasEnoughTasksForNextBatch()) {
if (batchWorkRequests.tryAcquire(1)) {
long now = System.currentTimeMillis();
int len = Math.min(maxBatchingSize, processingOrder.size());
List<TaskHolder<ID, T>> holders = new ArrayList<>(len);
while (holders.size() < len && !processingOrder.isEmpty()) {
ID id = processingOrder.poll();
TaskHolder<ID, T> holder = pendingTasks.remove(id);
if (holder.getExpiryTime() > now) {
holders.add(holder);
} else {
expiredTasks++;
}
}
if (holders.isEmpty()) {
batchWorkRequests.release();
} else {
batchSizeMetric.record(holders.size(), TimeUnit.MILLISECONDS);
batchWorkQueue.add(holders);
}
}
}
}
private boolean hasEnoughTasksForNextBatch() {
if (processingOrder.isEmpty()) {
return false;
}
if (pendingTasks.size() >= maxBufferSize) {
return true;
}
TaskHolder<ID, T> nextHolder = pendingTasks.get(processingOrder.peek());
long delay = System.currentTimeMillis() - nextHolder.getSubmitTimestamp();
return delay >= maxBatchingDelay;
}
How should the server solve this problem to protect the synchronization between the server clusters?
The text was updated successfully, but these errors were encountered:
Scene description: An abnormal eureka client sends dozens of renew requests within 1s. As a result, the number of nodes in the eureka server cluster is inconsistent, and node information cannot be synchronized between the two servers.
Analyze:When nodes are synchronized in the eureka server cluster, a batchTaskDispatcher is created to package and send tasks in batches, and tasks are queued in the AcceptorExecutor.
If the renewal frequency of an application instance(eureka.instance.lease-renewal-interval-in-seconds) is smaller than the synchronization execution frequency(MAX_BATCHING_DELAY_MS=500), and the Task of the application instance is at the head of the pendingTasks to be processed, the registry server fails to determine whether the difference between the task creation time and the current time is smaller than the synchronization execution time. As a result, the registry server does not put the renewal task in the batchWorkQueue to be executed.
How should the server solve this problem to protect the synchronization between the server clusters?
The text was updated successfully, but these errors were encountered: