Hey Asankha,

Thanks a lot for the quick response.

You do not state your client environment, I am specifically interested to see if it sends HTTP 1.0 or 1.1 requests to Synapse, and if Keepalives are used
Our client application also uses the HTTP/1.1 protocol, but when working with the HTTP/1.1 protocol we cannot choose to set the Keepalives parameter. The persistence parameter is false.
So are you saying that a direct client to Tomcat test has issues?
No, we left Synapse in the middle. But the only thing Synapse does is forwarding the incoming message to the Tomcat server. Here is the simple synapse.xml file:
<definitions xmlns="http://ws.apache.org/ns/synapse";>
   <in>
       <send>
           <endpoint>
<address uri="http://157.193.215.56:9090/axis2/services/DummyService2"; />
           </endpoint>
       </send>
   </in>
   <out>
       <send />
   </out>
</definitions>
This is great and I will look forward to your results. Meanwhile, if you can help me reproduce this test with the Apache Bench Java clone (that supports chunking, SSL etc - check the link I gave earlier for this) and Synapse, I can help you find the issue. You may send any confidential information privately to me if you please
I,ve attached 3 files: our roundrobin mediator, the Web Service (DummyService2) and the synapse.xml of the first tests. As you can see in the attached files roundrobin is just part of our tests. But currently the client is calling Synapse with the following command: POST http://<synapse's ip-address>:8000/roundrobin and the following SOAP-message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
   <soapenv:Body />
</soapenv:Envelope>


If there is anything else you need to clone our environment, do not hesitate to send me an e-mail.

Kind regards and thanks a lot,
Gregory
<definitions xmlns="http://ws.apache.org/ns/synapse";>
	<in>
		<switch source="get-property('To')">
			<case regex=".*/premium">
				<property name="priorityClass" value="premium" />
				<class name="be.ugent.ibcn.dybrows.mediators.RoundtripTimeMediator" />
				<class name="be.ugent.ibcn.dybrows.mediators.ServiceCallsMediator" />
				<class name="be.ugent.ibcn.dybrows.mediators.DistributedSelectionMediator" />
			</case>
			<case regex=".*/random">
				<class name="be.ugent.ibcn.dybrows.mediators.RandomSelectionMediator" />
			</case>
			<case regex=".*/roundrobin">
				<class name="be.ugent.ibcn.dybrows.mediators.RoundRobinSelectionMediator" />
			</case>
			<default>
				<property name="priorityClass" value="default" />
				<class name="be.ugent.ibcn.dybrows.mediators.RoundtripTimeMediator" />
				<class name="be.ugent.ibcn.dybrows.mediators.ServiceCallsMediator" />
				<class name="be.ugent.ibcn.dybrows.mediators.DistributedSelectionMediator" />
			</default>
		</switch>
		<send />
	</in>
	<out>
		<filter source="get-property('priorityClass')"
			regex="premium|default">
			<class name="be.ugent.ibcn.dybrows.mediators.RoundtripTimeMediator" />
			<class name="be.ugent.ibcn.dybrows.mediators.ServiceCallsMediator" />
		</filter>
		<send />
	</out>
</definitions>
package be.ugent.ibcn.dybrows.mediators;

import org.apache.axis2.addressing.EndpointReference;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.Constants;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;

import be.ugent.ibcn.dybrows.DybrowsProperties;

public class RoundRobinSelectionMediator extends AbstractMediator {

	private static final Log log = LogFactory.getLog(RoundRobinSelectionMediator.class);
      private static final Log trace = LogFactory.getLog(Constants.TRACE_LOGGER);
	
	public static int index = 0;
	
	public boolean mediate(MessageContext smc) {
		if (log.isDebugEnabled()) {
            log.debug("Round Robin Selection mediator :: mediate()");
        }
        boolean shouldTrace = shouldTrace(smc.getTracingState());
        if (shouldTrace) {
            trace.trace("Start : Round Robin Selection mediator");
        }
        String to = DybrowsProperties.getEndpoint(index);			//DybrowsProperties.getEndpoint(index) returns the service url of service endpoint <index>
		index = (index+1)%DybrowsProperties.getNrOfServices();	//DybrowsProperties.getNrOfServices() returns the number of service endpoints (here: 2)
		
        if (log.isDebugEnabled()) {
            log.debug("Set To-header: "+to);
        }
        if (shouldTrace) {
        	trace.trace("Set To-header: "+to);
        }
        smc.setTo(new EndpointReference(to));
        if (log.isInfoEnabled()) {
        	log.info("roundrobin;"+to+";"+smc.isFaultResponse());
        }
        
        if (shouldTrace) {
            trace.trace("End : Round Robin Selection mediator");
        }
        return true;
	}

}
package be.ugent.ibcn.dybrows;

import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;

public class DummyService {
	
	public static final String DUMMY_DOUBLE="dummyDouble";
	
	public double perform() {
		MessageContext msgContext = MessageContext.getCurrentMessageContext();
		Parameter param = msgContext.getParameter(DummyService.DUMMY_DOUBLE);
		
		long start = System.currentTimeMillis();
        long N = 19000000;
        double sum = 0.0;      // final sum
        double term;           // term without sign
        double sign = 1.0;     // sign on each term
        for (long k = 0; k < N; k++) {
           term = 1.0/(2.0*k + 1.0);
           sum = sum + sign*term;
           sign = -sign;
        }
        double pi = sum * 4.0;
        long stop = System.currentTimeMillis();
        System.out.println("time: " + (stop-start)/1000.0);
        
		if (param != null) {
			return new Double((String)param.getValue());
		} else {
			return Double.NaN;
		}
	}

}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to