-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JBPM-10184] Build templates optimization #1600
base: main
Are you sure you want to change the base?
Conversation
d6f5ebc
to
4335208
Compare
Add test on jbpm-wb-kie-server/jbpm-wb-kie-server-backend/src/test/java/org/jbpm/workbench/ks/integration/KieServerIntegrationServerTemplateTest.java |
jenkins do fdb |
ok to test |
@albfan are you adding the required test? Please respond/add it until Friday EOD |
I'm working on that test |
jenkins retest this please |
jenkins do fdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albfan Some questions about changing order of operations.
Also a test would be helpful to check that the optimization is working as expected and coverage is apropiated
else { | ||
logger.info("Server {} connected!", serverInstance); | ||
|
||
serverInstancesById.put(serverInstance.getServerInstanceId(), serverInstance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous code before this refactoring, the put operation was after buildClientsForServer
, not sure why it was moved before here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the purpose of the PR is to avoid calling buildClients if the server is already in the map. However, as mentioned in my comment, this should be done with computeIfAbsent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pushing a refactor with minimal changes so we can identify what changes, I think Gonzalo is right, put is changed, still not sure if that makes any difference
...kie-server-backend/src/main/java/org/jbpm/workbench/ks/integration/KieServerIntegration.java
Outdated
Show resolved
Hide resolved
ping @albfan, are you on this PR remaining test? |
...kie-server-backend/src/main/java/org/jbpm/workbench/ks/integration/KieServerIntegration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, but please check refactor comment for optimal implementation
4335208
to
e14bc1e
Compare
I think I can describe now what is this case for: Under openshift all kie server are under same location (replicas acts behind a smart router). If you start a kie server with 3 replicas you will have 3 exact request of onServerInstanceConnected. if serverInstancesById put is set after the build, you will get 3 builds. Setting put first you filter that. Probably same behaviour as a smart router. That probably will mark no available endpoints if some kie server is shutdown (while there're still 2 kie servers alive) Let me check if we allow duplicates on loadbalancer, at least with smart router, if no this is not correctly handled |
jenkins retest this |
So this optimization is just a corner case to detect an ongoing task that will end on
|
e14bc1e
to
19f7cdc
Compare
19f7cdc
to
15c3513
Compare
All request will come from same url, and will not detect ongoing builds
@gmunozfe I keep the current behaviour (put after build) probably unneeded if @fjtirado I added a tentative property to deal with this corner case (repeated builds from same url) this can only happen with customer with kie servers under load balancer, and starting at same time several kie servers (like openshift does with replicas) Still using this |
return clients; | ||
}); | ||
|
||
serverInstancesById.put(serverInstance.getServerInstanceId(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should be removed. serverInstance will be added to the map when this function returns
if (Boolean.parseBoolean(System.getProperty("org.kie.server.startup.detectOpenshiftLoadBalancer", "false"))) { | ||
serverInstancesById.put(serverInstance.getServerInstanceId(), | ||
serverInstance); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Boolean.parseBoolean(System.getProperty("org.kie.server.startup.detectOpenshiftLoadBalancer", "false"))) { | |
serverInstancesById.put(serverInstance.getServerInstanceId(), | |
serverInstance); | |
} | |
if (Boolean.getBoolean("org.kie.server.startup.detectOpenshiftLoadBalancer")) { | |
return serverInstance; | |
} |
serverInstance); | ||
return serverInstance; | ||
}); | ||
if (serverInstance != serverInstanceKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do that differently, rather than tracing "isAlreadyRegistered", add a trace when it is registered. If this new registering trace is not present, it can be assumed it has not been registered
RHPAM-4746
This change tries to avoid extra builds after a template is already build.
TODO: Still unsure if that could lead to errors if template is changed and new execution servers are registered