Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Creating a streaming web service with Spring-WS

  1. #11
    Join Date
    Jul 2008
    Posts
    4

    Default

    Short term solution is to adjust your JVM -Xmx to something like 1024 whould get you through about 100MB in message size (bloats to up to 10x the message size in memory, ) hope that helps.

  2. #12
    Join Date
    Aug 2008
    Posts
    4

    Default

    Quote Originally Posted by jrabbitb View Post
    Short term solution is to adjust your JVM -Xmx to something like 1024 whould get you through about 100MB in message size (bloats to up to 10x the message size in memory, ) hope that helps.
    I'm not running into memory issues, yet. The bigger issue is that the client may timeout before a response is received.

  3. #13
    Join Date
    Jul 2008
    Posts
    4

    Default

    Quote Originally Posted by bkim View Post


    When I make a request using SoapUI (in Eclipse) I get read timeouts because the web service appears to be building the response in memory instead of streaming it out--at least that's what it appears to be doing. Are there any examples of a streaming Spring web service out there? Should I be looking at other alternatives? The service I'm coding needed to be in production yesterday (of course).
    Sorry, i didn't read your message closely enough the first time.

    the problem is that yes, StAX will let you stream read your xml, but when you are building the SOAP message it must load the entire xml tree into memory. so sadly the answer right now is, no, there is no fix for this to force it to stream out but you should be able to change your connection timeout in code, i'm just not sure where off the top of my head, sorry.

  4. #14
    Join Date
    Aug 2008
    Posts
    4

    Default

    Quote Originally Posted by jrabbitb View Post
    the problem is that yes, StAX will let you stream read your xml, but when you are building the SOAP message it must load the entire xml tree into memory. so sadly the answer right now is, no, there is no fix for this to force it to stream out but you should be able to change your connection timeout in code, i'm just not sure where off the top of my head, sorry.
    I figured as much. This is what I did to increase the timeout:

    Code:
    	<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
    		<property name="messageSender">
    			<bean class="org.springframework.ws.transport.http.CommonsHttpMessageSender">
    				<property name="acceptGzipEncoding" value="true"/>
    				<property name="readTimeout" value="600000"/>
    			</bean>
    		</property>
    	</bean>
    Does anyone know if other web service frameworks have the same streaming limitation (e.g. Axis, CXF...)?

  5. #15
    Join Date
    Jul 2008
    Posts
    4

    Default

    i know axis has the limitation. AXIOM is the AXIs Object Model. And unless something has changed you will find the same problem everywhere. You could manually break the message up and send several smaller chunks, this could help but is a pain to code. another option going back to the -Xmx idea is also to set the -Xms to a higher value. the default is 64MB, when the jvm fills that it will request more memory and expand the heap up to the -xmx, if you set the xms higher then 64mb then the jvm will not take as much time building the message and thus you may be able to avoid your timeout issue.

    problems on both solutions are:
    if you adjust the jvm you are not going to really fix the timeout issue just help avoid it.
    the problem with sending chunks is increased coupling between sender and receiver.

  6. #16
    Join Date
    Aug 2006
    Posts
    1

    Default

    so can I then draw the conclusion that Spring-ws is only usable with low concurrent usage and/or small messages?

  7. #17
    Join Date
    Dec 2009
    Posts
    1

    Default

    Quote Originally Posted by jimpo View Post
    Thanks.

    To make sure I read your answer correctly, do you mean that I can create a streaming web service right now, using Spring-WS as is, if I don't use any interceptors? Or, that it would be possible, if Spring-WS would be implemented a bit differently?

    I need to create a streaming web service. Basically I am just trying to gather whether I can use Spring-WS to do it, or do I need to use some other solution (xfire, some other?).

    You mention a different kind of SoapMessageFactory. Would it be feasible for us to implement a new implementation of SoapMessageFactory and use it for the streaming web services (and continue to use the "normal" SoapMessageFactory for the regular ones, which we also have). How easy or difficult would the implementation and configuration be?
    Have you heard of vtd-xml? It is a far more advanced option that excels in performance and memory usage at the same time...

    http://vtd-xml.sf.net

  8. #18

    Default

    Quote Originally Posted by jrabbitb View Post
    Short term solution is to adjust your JVM -Xmx to something like 1024 whould get you through about 100MB in message size (bloats to up to 10x the message size in memory, ) hope that helps.
    I thought this too until I realized that log4j was using half of that 10x. I set the MessageTracing logger to ERROR that got it to about 5x. After increasing my eden space, I decreased it to about 2.5X for a 100mb file.

    Logger Server Side:
    Code:
    log4j.logger.org.springframework.ws.server.MessageTracing=ERROR
    Logger Client Side:
    Code:
    log4j.logger.org.springframework.ws.client.MessageTracing=ERROR
    Heap and Eden increase:
    Code:
    -Xms512m
    -Xmx1300m
    -XX:NewSize=256m

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •