Sunday 7 July 2013

WSO2 Stratos 1.6 – Testing the Application Server worker nodes behavior using soapUI

In this example I'm going to explain how to test the behavior of Application Server worker nodes when its deal with a heavy load of web requests which is generated using soapUI.

Prerequisites
Please refer the my previous blog to find the information about how to download, install and initialize the servers.

Step 1:
Write a simple Hello service as follows and export project as deployable archive.

package org.wso2.sample;

import java.util.Date;

public class HelloService{

public String sayHello(String name) {
String message = "Hello, " + name + "! " + System.currentTimeMillis();
System.out.println(message + " " + new Date());
System.out.flush();
return message;
}

}

Step 2:
Log in to the management console of Application Server management node and deploy the created Axis2 Web service (Go to Manage --> Axis2 Services --> Add --> AAR service). Once the service is deployed in the management node go to the services list and click on 'Try this service' to make sure that the created service functioning well.


Step 3:
Then create a new soapUI project using the Hello service, WSDL1.1.

After that, right click on the 'Request 1' and add it to Test case and then the project list will be updated as follows;

To create a heavy load of request, you have to create new load test by right click on 'Load Tests' link. Once you create the load test you will get a window as follows to adjust the load according to you requirement. i.e. increasing the no of Threads in to 100.

Step 4:
Click on 'run' button and check the server logs which passing in to Application Server worker node01 and node02.

Saturday 6 July 2013

WSO2 Stratos 1.6 – Setting up an additional WSO2 Application Server Worker node to the WSO2 Stratos ELB.

In this example I'm going to explain you the minimum configuration that would guide you to set up another worker node to the Stratos ELB in a case if you need to configure another worker node to the Stratos setup.

Prerequisites
Please refer the Udara Liyanage's blog to find the information about how to download, install and initialize the servers.

Step 1:
Follow the <wso2-stratos-setup-home>/worker path and check available worker nodes using following command;
~/wso2-stratos-local-setup-1.6.0/worker$ ls


Get a copy of available Application Server instance and paste it on the same folder by renaming it.
Ex: wso2as-5.0.2 as wso2as-5.0.2-2


Step 2 (axis2.xml configuration):
We need to change the localMemberBindPort and the localMemberPort in the axis2.xml to make a separate communication port to the load balancer with the newly created worker node. Open <wso2-stratos-setup-home>/worker/wso2as-5.0.2/repository/conf/axis2/axis2.xml and update the configuration as shown below.
<parameter name="localMemberBindPort">4305</parameter>
<parameter name="localMemberPort">4305</parameter>

Step 3 (carbon.xml configuration):
We going to run multiple WSO2 Carbon based products in same host, so we need to change the port offset to avoid the possible port conflicts. In order to do that, open <wso2-stratos-setup-home>/worker/wso2as-5.0.2/repository/conf/carbon.xml and increment available offset by 1.
i.e. <Offset>4</Offset>

Step 4 (stratos.sh configuration):
To start the newly created Application Server worker node as ./stratos.sh you need to update the stratos.sh with the new worker node information as follows;
Open the stratos.sh file and add the new entry to the list as follows;

as_mgt=wso2as-5.0.2
as_worker=wso2as-5.0.2
as_worker2=wso2as-5.0.2-2
bps_mgt=wso2bps-3.0.1
bps_worker=wso2bps-3.0.1
cep=wso2cep-2.0.1
dss_mgt=wso2dss-3.0.1
dss_worker=wso2dss-3.0.1
greg=wso2greg-4.5.3
mb=wso2mb-2.1.0
manager=wso2stratos-manager-2.0.2
bam=wso2bam-2.1.0
brs_mgt=wso2brs-2.0.0
brs_worker=wso2brs-2.0.0
cg=wso2cg-1.0.0
esb_mgt=wso2esb-4.6.0
esb_worker=wso2esb-4.6.0
is=wso2is-4.0.1
ss=wso2ss-1.0.2
ts=wso2ts-1.0.1
elb=wso2elb-2.0.2

Also add the new worker node to the start_stop() method as follows;

elif [ $1 == "as_worker" ] || [ $1 == "as_worker2" ] || [ $1 == "esb_worker" ] || [ $1 == "dss_worker" ] || [ $1 == "bps_worker" ] || [ $1 == "brs_worker" ] ;

At the end add it to the echo list that show the available services as well.

echo "manager as_mgt as_worker as_worker2 esb_mgt esb_worker dss_mgt dss_worker bps_mgt bps_worker brs_mgt brs_worker greg bam cep mb cg is ss ts"

So once you run ./stratos.sh start command you will see the newly created Application Server node in the list as follows;



Step 5 (start up new worker node):
Run following command to start up the new worker node.

./stratos.sh start 'as_worker2'

Once the new worker node joins the cluster, you will see the following messages in WSO2 Load Balancer logs. Check the different ports assigned to Worker node1 (4300) and node2 (4305) in LB logs as follows;
node 1:
TID: [0] [ELB] [2013-07-06 13:45:08,687]  INFO {org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler} -  Received JOIN message from 127.0.0.1:4300(wso2.appserver.domain) {org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler}
TID: [0] [ELB] [2013-07-06 13:45:19,689]  INFO {org.apache.axis2.clustering.management.DefaultGroupManagementAgent} -  Application member Host:127.0.0.1, Remote Host:null, Port: 4300, HTTP:9766, HTTPS:9446, Domain: wso2.appserver.domain, Sub-domain:worker, Active:true joined application cluster {org.apache.axis2.clustering.management.DefaultGroupManagementAgent}
TID: [0] [ELB] [2013-07-06 13:45:19,690]  INFO {org.apache.axis2.clustering.tribes.MembershipManager} -  Application member 127.0.0.1:4300(wso2.appserver.domain) joined group wso2.appserver.domain {org.apache.axis2.clustering.tribes.MembershipManager}

node 2:
TID: [0] [ELB] [2013-07-06 13:47:05,817]  INFO {org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler} -  Received JOIN message from 127.0.0.1:4305(wso2.appserver.domain) {org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler}
TID: [0] [ELB] [2013-07-06 13:47:16,821]  INFO {org.apache.axis2.clustering.management.DefaultGroupManagementAgent} -  Application member Host:127.0.0.1, Remote Host:null, Port: 4305, HTTP:9767, HTTPS:9447, Domain: wso2.appserver.domain, Sub-domain:worker, Active:true joined application cluster {org.apache.axis2.clustering.management.DefaultGroupManagementAgent}
TID: [0] [ELB] [2013-07-06 13:47:16,821]  INFO {org.apache.axis2.clustering.tribes.MembershipManager} -  Application member 127.0.0.1:4305(wso2.appserver.domain) joined group wso2.appserver.domain {org.apache.axis2.clustering.tribes.MembershipManager}

Testing the cluster
To test that whether the startup worker nodes are working simultaneously you can follow the way as describe below;
  • Log in to the management console of Application Server management node
  • Deploy a new Axis2 Web service (Go to Manage --> Axis2 Services --> Add --> AAR service)
  • Once the service is deployed in the management node go to the services list and click on Tryit
  • Invoke the service
Once you send bulk set of requests to the load balancer you will notice that the requests are simultaneously handle by the worker node 1 and worker node 2 by analyzing the server log entries of worker node 1 and worker node 2. (Testing the cluster using soapUI - next blog)