jbpm-wb icon indicating copy to clipboard operation
jbpm-wb copied to clipboard

[JBPM-10184] Build templates optimization

Open albfan opened this issue 1 year ago • 13 comments

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

albfan avatar Jul 25 '23 07:07 albfan

Add test on jbpm-wb-kie-server/jbpm-wb-kie-server-backend/src/test/java/org/jbpm/workbench/ks/integration/KieServerIntegrationServerTemplateTest.java

albfan avatar Jul 25 '23 13:07 albfan

jenkins do fdb

mareknovotny avatar Aug 07 '23 07:08 mareknovotny

ok to test

mareknovotny avatar Aug 07 '23 07:08 mareknovotny

@albfan are you adding the required test? Please respond/add it until Friday EOD

mareknovotny avatar Aug 09 '23 09:08 mareknovotny

I'm working on that test

albfan avatar Aug 21 '23 06:08 albfan

jenkins retest this please

mareknovotny avatar Dec 13 '23 10:12 mareknovotny

jenkins do fdb

mareknovotny avatar Dec 13 '23 10:12 mareknovotny

any progress on updates after review @albfan ? Also @nmirasch could you review this too?

mareknovotny avatar Jan 05 '24 09:01 mareknovotny

ping @albfan, are you on this PR remaining test?

mareknovotny avatar Feb 13 '24 13:02 mareknovotny

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

albfan avatar Feb 21 '24 10:02 albfan

jenkins retest this

fjtirado avatar Feb 21 '24 11:02 fjtirado

So this optimization is just a corner case to detect an ongoing task that will end on

    protected void indexServerInstances(ServerTemplate serverTemplate) {
        serverTemplate.getServerInstanceKeys().forEach(serverInstanceKey -> serverInstancesById.put(serverInstanceKey.getServerInstanceId(),
                                                                                                    serverInstanceKey));
    }
    ```
    
which just happens after all kjars are build, but that will ignore any possible error deploying the template

albfan avatar Feb 21 '24 12:02 albfan

@gmunozfe I keep the current behaviour (put after build) probably unneeded if indexServerInstances is reached, but if no build is triggered probably still needed. I think in case of error building this is wrong, but that's different story

@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 serverInstancesById looks wrong, as probably what we want to detect is we already started a build for that (like a cache of ongoing builds) to allow all the detection of fails to continue

albfan avatar Feb 22 '24 10:02 albfan