Skip to content

Conversation

@chengyouling
Copy link
Contributor

No description provided.

Comment on lines 30 to 32
service:
warmup:
enabled: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature will cause demo-edge fail? Is it an incompatible feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compatible for edge

Comment on lines 75 to 76
String registerTimeStr = StringUtils.isBlank(server.getInstance().getTimestamp()) ? "0" :
server.getInstance().getTimestamp();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all Discovery implementation has timestamp and service center is server time not application time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to set register time by instance property

Comment on lines 193 to 194
// add register time for warm up
propertiesMap.put(InstancePropertiesConst.REGISTER_TIME_KEY, String.valueOf(System.currentTimeMillis()));
Copy link
Contributor

@liubao68 liubao68 Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Distributed time may not always same for different instance, and weighted for instance is not only depended on instance startup time, but time accessed of the consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add provider invoke time to calculate weight

Comment on lines 82 to 93
private void refreshMapCache() {
List<String> removeKeys = new ArrayList<>();
for (Map.Entry<String, Long> entry : instanceInvokeTime.entrySet()) {
if (System.currentTimeMillis() - entry.getValue() > ignoreWarmUpTime) {
removeKeys.add(entry.getKey());
}
}
if (CollectionUtils.isEmpty(removeKeys)) {
return;
}
removeKeys.forEach(instanceInvokeTime::remove);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it removing not exist instance? Seems remove invoked instance will cause problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 20 to 22
public class InstancePropertiesConst {
public static final String REGISTER_TIME_KEY = "registerTime";
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If can make it simple, do not depends on register time? I think first access time is quite enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

.setNameFormat("warm-up-cache-refresh-%d")
.build());
ignoreWarmUpTime = getIgnoreWarmUpTime();
executor.scheduleAtFixedRate(this::refreshMapCache, 0, 10, TimeUnit.MINUTES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe do not need a timer. You can remove not exist instance id every more 10 minutes when choosing server(condition e.g. not exist and last accessed time is more than 30 minutes).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@liubao68 liubao68 closed this Jan 3, 2025
@chengyouling chengyouling deleted the 2.8.x-warm branch January 14, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants