users@glassfish.java.net

Test results from Fast Infoset comarison to SOAP not as expected

From: <forums_at_java.net>
Date: Tue, 11 Sep 2012 10:55:31 -0500 (CDT)

We are building a high-throughput back-end system that will be sending and
retrieving variably sized byte[]. The bindings are critical for this project
so we have been testing SOAP, REST, and Fast Infoset and using a Memcached
client as our baseline. Our tests don't reveal any difference between the
round trip times of the SOAP and Fast Infoset clients. It was my expectation
that Fast Infoset would improve the transmission times. Am I doing something
wrong? Is there a better solution? Glassfish 3.1.2 jdk 1.7 Our client: The
two clients are the same accept for one line of code.
((javax.xml.ws.BindingProvider)
_port).getRequestContext().put(JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY,
"pessimistic"); It is my understanding that including that line of code with
my client will enable Fast Infoset protocol between the client and the
service. Below is the Fastinfo Set client. You can imagine the regular SOAP
client without the above line of code. public EpCacheFiClient(long period) {
try { _service = new EpCacheService(new URL(WSDL_URL_KEY), QNAME); _port =
_service.getEpCachePort(); ((javax.xml.ws.BindingProvider)
_port).getRequestContext().put(JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY,
"pessimistic"); if (_port != null) { System.out.println("Found service
port!"); } else { System.exit(128); } } catch (MalformedURLException e) {
e.printStackTrace(); } } Here is the service code. We use the same endpoint
on the instruction that the client will engage the Glassfish server in using
Fastinfo set, which is supposed to be on by default. @WebService(name =
"EpCache", serviceName = "EpCacheService", portName = "EpCachePort",
targetNamespace = "http://epcache.webservices.ese.com") public class
EpWsCacheService { @Inject private IServiceLogger _logger; @Inject private
IEpService _epCacheService; /** * * @param cacheItemId * @param cacheItemData
* @return * @throws EpServiceException */ @WebMethod(operationName =
"processEpCacheSet", action = "urn:ProcessEpCacheSet") public String
processEpCacheSet( @WebParam(name = "id") String cacheItemId, @WebParam(name
= "data") byte[] cacheItemData) throws EpServiceException { String
epCacheItemId = null; try { epCacheItemId =
_epCacheService.asyncSetRequest(cacheItemId, cacheItemData); } catch
(Exception e) { _logger.log(Level.SEVERE, "Error calling syncGet() for
cacheItemId {0}. {1}", new Object[] { cacheItemId, e.getMessage() }); throw
new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); }
return epCacheItemId + " added to cache!"; } Finally here is our data random
generator. Random rand = new Random( seed ); //Test 100,000 requests for(int
i = 0; i != requests; i++){ int randomNum = rand.nextInt(max - min + 1) +
min; byte[] byteArray = new byte[randomNum]; Random randBytes = new Random();
randBytes.nextBytes(byteArray); // set cache item long time = -1; time =
sgcI.measureSet("" + randomNum, byteArray);//abstraction on service call
setResults.put(randomNum, time); }

--
[Message sent by forum member 'pcootey']
View Post: http://forums.java.net/node/890126