Load Balancer

Primary purpose of this section are used to demonstrate Load Balancer of spring-boot-cxf-jaxrs which created in previous chapter.

Scaling the Application

Scaling spring-boot-cxf-jaxrs to 2 instances via:

$ oc scale --replicas=2 deploymentconfig spring-boot-cxf-jaxrs
deploymentconfig "spring-boot-cxf-jaxrs" scaled

To verify new created instance:

$ oc get pod --show-all=false
NAME                               READY     STATUS    RESTARTS   AGE
spring-boot-cxf-jaxrs-4-jc4ss      1/1       Running   0          6m
spring-boot-cxf-jaxrs-4-w0rxw      1/1       Running   0          3m
vdb-datafederation-swarm-1-2lknm   1/1       Running   0          3h

Verify Load Balancer

  • Verify 2 pods' log

Pod 1
$ spring-boot-cxf-jaxrs-4-jc4ss
...
2017-07-06 07:04:57.279  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 9 ms
Pod 2
$ oc log spring-boot-cxf-jaxrs-4-w0rxw
...
2017-07-06 07:08:08.250  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 10 ms
Note
Both pod don’t have any api query info.
  • Access /rest/query several times, verify two instance log:

Pod 1
$ spring-boot-cxf-jaxrs-4-jc4ss
...
2017-07-06 07:04:57.279  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 9 ms
/rest/query
/rest/query
/rest/query
/rest/query
Pod 2
$ oc log spring-boot-cxf-jaxrs-4-w0rxw
...
2017-07-06 07:08:08.250  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 10 ms
Note
Pod 2 don’t have any api query info, all queries are go into Pod 1.
  • Switch to another web broswer, access /rest/query 3 times, verify two instance log:

Pod 1
$ spring-boot-cxf-jaxrs-4-jc4ss
...
2017-07-06 07:04:57.279  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 9 ms
/rest/query
/rest/query
/rest/query
/rest/query
Pod 2
$ oc log spring-boot-cxf-jaxrs-4-w0rxw
...
2017-07-06 07:08:08.250  INFO 1 --- [0.0-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 10 ms
/rest/query
/rest/query
/rest/query
Note
New request are go into Pod 2.

results matching ""

    No results matching ""