axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-2968) Out-Of-Memory error on server side - Use of wsdl4j WSDLDefinition
Date Thu, 20 Sep 2007 11:01:34 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2968?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Amila Chinthaka Suriarachchi updated AXIS2-2968:
------------------------------------------------

    Attachment: wsdlFromFileSystem.patch

here is an another option for this problem.

we keep wsdl4j object structure in memory to show the wsdl file to the user when they request
with ?wsdl.

So if we can display the wsdl file without keeping the wsd4j definition then there is not
need to keep the
wsdl4j object and hence solve the problem.

Here is the way I suggest to display the wsdl.

For the moment wsdl file is kept in the aar file and here I am suggesting to let users to
keep them in a
seperate folder. This allows them to an directory hiarachy to manage the wsdl files.

To get the wsdl location we can use two parameters.
1. wsdlBaseUri used in axis2.xml to keep the base uri location
2. wsdlFileLocation used in service.xml keep the exact wsdl location.

Here is the way.
When the first request comes ?wsdl, Axis2 redirect the request giving the wsdl location
This is done by adding the wsdl file path to  the contextRoot and serviceName.

i.e.
AxisService axisServce = (AxisService) serviceObj;
                        Parameter wsdlFileLocationParameter = axisServce.getParameter("wsdlFileLocation");
                        if (wsdlFileLocationParameter != null){
                            String wsdlLocation = (String) wsdlFileLocationParameter.getValue();
                            String redirectUrl = null;
                            if (configContext.getServiceContextPath().endsWith("/")){
                                redirectUrl = configContext.getServiceContextPath()
                                    + serviceName + "/" + wsdlLocation;
                            } else {
                                redirectUrl = configContext.getServiceContextPath()
                                    + "/" + serviceName + "/" + wsdlLocation;
                            }
                            res.sendRedirect(redirectUrl);
                           
                        }

then when the requests come to show the wsdl and xsd files Axis2 can simply append the file
path to
the base uri and get that from the file system.

String uri = req.getRequestURI();
        String contextPath = configContext.getServiceContextPath();
        String servicePart = null;
        if (configContext.getServiceContextPath().endsWith("/")){
             servicePart = uri.substring(uri.indexOf(contextPath) + contextPath.length());
        } else {
            servicePart = uri.substring(uri.indexOf(contextPath) + contextPath.length() +
1);
        }
        String serviceName = servicePart.substring(0, servicePart.indexOf("/"));
        String filePath = servicePart.substring(servicePart.indexOf("/") + 1);

        AxisService axisServce = configContext.getAxisConfiguration().getService(serviceName);
        Parameter wsdlFileLocationParameter = axisServce.getParameter("wsdlFileLocation");
        if (wsdlFileLocationParameter != null) {
            //i.e we have the wsdl file locator
            Parameter wsdlBaseUriParameter =
                    configContext.getAxisConfiguration().getParameter("wsdlBaseUri");
            if (wsdlBaseUriParameter != null) {
                String wsdlBaseUri = (String) wsdlBaseUriParameter.getValue();
                String fileToRead = wsdlBaseUri + filePath;
                // read and send the file
                InputStream fileInputStream = new FileInputStream(fileToRead);
                if (fileInputStream != null) {
                    OutputStream out = res.getOutputStream();
                    res.setContentType("text/xml");
                    ListingAgent.copy(fileInputStream, out);
                    out.flush();
                    out.close();
                    return;
                }
            }
        }

I have attached the complete patch for the same jira.

This works fine when the wsdl file is viewed from the browser. Browsers can handle redirect
correctly.

The problem is when I try to generate the code for this using wsdl2java tool it does not work
since,
wsdl4j can not handle redirects properly.

if I give the url directly to the wsdl without using the ?wsdl it works fine.

> Out-Of-Memory error on server side - Use of wsdl4j WSDLDefinition
> -----------------------------------------------------------------
>
>                 Key: AXIS2-2968
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2968
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Ann Robinson
>            Assignee: Ann Robinson
>            Priority: Critical
>         Attachments: patch_01.txt, patch_02_part1.txt, wsdlFromFileSystem.patch
>
>
> In some server-side environments, there is an out-of-memory problem when      
> attempting to handle a large number of JAXWS-based web service applications.  
>                                                                               
> In the test scenario that fails, the server is attempting to load and start   
> 100 web service applications. A variety of heap sizes was tried to see if     
> a heap size for the server could be found to work, ranging from 1 GB to 4 GB. 
> Increasing the heap size did not work - the out-of-memory error continued to  
> occur.                                                                        
> In analyzing the java heap dumps, one of the biggest consumers of the memory  
> is with the wsdl4j WSDLDefinition objects.  In the test scenario, the         
> wsdl4j-related objects consumed about a quarter to a third of the entire heap.
>                                                                               
> The WSDLDefinition object is a very heavy-weight object, much of which stems  
> from its use of the xerces dom objects as underlying support, particularly    
> for the schemas.                                                              
>                                                                               
> One area to investigate is the saving of the WSDLDefinition as a Parameter    
> in the AxisService's ParameterInclude list so that, if some component needs   
> to utilize the WSDLDefinition object, it can be accessed via the AxisService  
> object.                                                                       
>                                                                               
> Is it possible to reduce the utilization of the WSDLDefinition?               
> Some ideas are:                                                               
> (a) releasing it when it is no longer needed                                  
>          - this might not be possible to determine                            
>                                                                               
> (b) putting a wrapper on the WSDLDefinition                                   
>          - so that the WSDLDefinition,or a portion of the WSDLDefinition,     
>            can be released                                                    
>          - but if the WSDLDefinition is accessed after it was released,       
>            the wrapper can reload the WSDLDefinition transparently to the     
>            user                                                               
>                                                                               
> (c) create a layer for caching wsdl-related information                       
>          - this would allow for releasing memory based on some algorithm      
>            and/or interface that could indicate what's no longer needed       
>                                                                               

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message