blob: b7bbb64b1add0568901c23be9a2b1821753f5747 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
WebApp Load Balancing Demo
===========================
Demonstrates balancing load acoss SCA services by deploying an SCA composite
to two tomcat servers in a cluster. The tomcat servers sit behind an Apache
server which directs load to one or other tomcat server based on a set of rules.
The mvn pom distributed with this sample will download, install and configure
two Tomcat servers automatically to act as workers. You need to install the
Apache web server and configure it manually.
1 - Install and configure the Tomcat workers
mvn
This results in two tomcat servers at
target/tomcat-8085
target/tomcat-8086
2 - Install and configure the Apache server to balance load
In this case we've chosen to use the native JK connector. There are several
resources that tell you how to configure Apache for load balancing Tomcat with
the JK connector. For example,
http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
http://www.crazysquirrel.com/computing/debian/servers/tomcat55.jspx
Here is a high level summary
Download the latest version of Apache 2.2 (this demo was built with Apache 2.2.6)
http://httpd.apache.org/
Install in a local director called, say, apache
Download the mod_jk module (in binary form if you can)
http://tomcat.apache.org/download-connectors.cgi
Install it in apache/modules
Configure the mod_jk module
Copy src/test/resources/apache-80/conf/workers.properties to apache/conf
Append the contents of src/test/resources/apache-80/conf/httpd.conf to apache/conf/httpf.conf
3 - Start the apache and tomcat servers
In three command prompts
cd target/tomcat-8085
bin/catalina run
cd target/tomcat-8086
bin/catalina run
cd apache
bin/httpd
4 - Run the client
run the LanchClient program - TBD - need a script
5 - Result
The client will make 10 calls to the SCA service described in the helloworldws.composite that
is part of the webapp deployed to the tomcat servers. You will see the result of this
service call reported at the client in the form
Called getGreetings
Hello World 6
If you look at the Tomcat consoles you will see that each server deals with half the requests
as the load is balanced equally between the two of them.
|