#################################################################

	Milestone 1 (Aug 20, 2007) Proxy features

#################################################################


The proxy functionality available in the http path can be deployed in 2 
configurations

1. An instance acting as a front-end (loadbalancer) and a cluster acting
as a backend (where application is deployed and is serving requests).

The following settings have to be made to achieve the above.

The backed cluster configuration does not require any change

The frontend instance has to be configured with the following properties


Modify the property of the http listener to add the follwing in the
proxued protocol property

asadmin command :

$AS91_HOME/bin/asadmin set --passwordfile <passfile> --user <adminuser>
<instancename>-config.http-service.http-listener.http-listener-1.property.proxiedProtocols=ws/tcp,lb/http

The "ws/tcp" protocol is present by default when an instance is created, we have just updated it to
include our protocol "lb/http".


Add the following system properties as jvm options

Name : org.jvnet.glassfish.comms.clb.proxy.instances
Value : localhost:1111,localhost:1112	,localhost:1113
(backend instances list)

Name : org.jvnet.glassfish.comms.clb.proxy.loglevel
Value : Loglevel for proxy


Name : org.jvnet.glassfish.comms.clb.proxy.localport
Value : http listener port of the instance
		e.g 9090

Restart the instance, deploy an application in the backend cluster 
and send a request to the http listener of the frontend instance,
the request will be routed to one of the backends.

--------------------------------------------------------------------------
Known issues
-------------------------------------------------------------------------

1. Occassinally there might be no response, this is because sometimes the 
client APIs of the connector take a long time to connect or do not connect
to the backend properly. Just retry the request if this happens.

=======================================================================

2. A sailfin cluster where the instances act as both frontend (loadbalancers)
and backends (application processing).

Following settings have to be made to achieve the above.

The cluster configuration needs to be updated with following settings.

Modify the property of the http listener to add the follwing in the
proxued protocol property

asadmin command :

$AS91_HOME/bin/asadmin set --passwordfile <passfile> --user <adminuser>
<clustername>-config.http-service.http-listener.http-listener-1.property.proxiedProtocols=ws/tcp,lb/http

The "ws/tcp" protocol is present by default when an instance is created, we have just updated it to
include our protocol "lb/http".

Add the following system properties as jvm options
This property is the same for all the instances

Name : org.jvnet.glassfish.comms.clb.proxy.instances
Value : <hostname1>:<port1>,hostname2>:<port2>,<hostname3>:<port3>
(backend instances list) where the port numbers are the http listener ports 
of the backed and the hostnames are the hostnames of the backed instances in the
cluster.
e.g localhost:1111,localhost:1112,localhost:1113

The following property has to be different for each instance in the cluster

Name : org.jvnet.glassfish.comms.clb.proxy.localport
Value : http listener port of that instance
		e.g 1111 	

Name : org.jvnet.glassfish.comms.clb.proxy.loglevel
Value : Loglevel for proxy


Restart the cluster, deploy an application in the backend cluster 
and send a request to the http listener of any of  instance in the cluster,
the request will be routed to one of the instances in the cluster or
will be server by itself. Since the routing algorithm is a simple roundrobin, when a 
request is sent to an instance, it is routed to first instance, second request 
to second instance and so on.....
If the instance happens to be the local backend instance it is processed by
the web container.

--------------------------------------------------------------------------
Known issues
-------------------------------------------------------------------------

1. If the backend instance is determined to be the local instance then
after the response is returned any subsequent requests that use the same socket
channel will return an error response. 
