Re: PoC Wildfly Buildpack and problems with load-balancing


Matt Cholick
 

I'd guess WildFly is setting JSESSIONID when first visiting the app, which
would stick your browser session to the same app instance.

On Mon, Aug 29, 2016 at 3:50 PM, Thomas Darimont <
thomas.darimont+github(a)gmail.com> wrote:

Hello group,

this is my first post to this list so I hope I'm at the right place with
my problem :)

For a PCFDev demo at our Java User Group I wanted to deploy a Java EE App
on Wildfly to Cloud Foundry via (PCFDev).
I noticed that there is only a rather old JBoss buildpack available so I
created a prototypic Wildfly (10.1.0.x) buildpack.
I think having such a buildpack would be quite useful - could help to ease
moving legacy Java EE Apps to CF.

With this new wildfly buildpack I'm able to successfully deploy a sample
Java EE App to Cloud Foundry - yay :)
I can also scale up to multiple instances - however external http requests
are only ever
hitting a single application instance.

(I added some output of VCAP_APPLICATION, CF_INSTANCE_GUID/CF_INSTANCE_INDEX
env variables to the hello.xhtml
page in the example app to verify this).

PoC Wildfly Buildpack: https://github.com/thomasdarimont/wildfly-buildpack
JavaEE Petclinic Example app with manifest: https://github.com/
thomasdarimont/javaee7-petclinic/tree/poc/pcf-dev

It seems that the load-balancing isn't working correctly.
Can anybody give me a hint at what might be the problem?

Some steps to reproduce the problem:
0) start pcf dev
cf dev start

1) login to pcfdev
cf login -a https://api.local.pcfdev.io --skip-ssl-validation

2) checkout & build example app
git clone https://github.com/thomasdarimont/javaee7-petclinic.git
cd javaee7-petclinic
git checkout poc/pcf-dev
mvn package

3) deploy to pcfdev
cf deploy

4) Scale to 2 instances
cf scale javaee-petclinic -i 2

5) Observe the logs in a new terminal
cf logs javaee-petclinic

6) Send some requests to the sample app
Refresh the page several times: http://javaee-petclinic.local.
pcfdev.io/hello.jsf

Expected:
Some requests should be handled by different APP instances so there should
be alternating
APP/0, APP/1 entires visible in the logs...

Note thate one can clearly see the application instance booting:
2016-08-30T00:24:18.65+0200 [APP/0] OUT 22:24:18,648 INFO [
org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full
10.1.0.Final (WildFly Core 2.2.0.Final) started in 12375ms - Started 638 of
874 services (404 services are lazy, passive or on-demand)
...
2016-08-30T00:25:05.58+0200 [APP/1] OUT 22:25:05,581 INFO [
org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full
10.1.0.Final (WildFly Core 2.2.0.Final) started in 12174ms - Started 638 of
874 services (404 services are lazy, passive or on-demand)

Cheers,
Thomas

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.