I am writing a Web Service client using JAX-WS with Metro 2.3 RI.
My application is Multi Threaded and supposed to endure an heavy load there for I keep the Service (Thread Safe) as a static member and use an Object Pool for the Port objects.
The problem is that whenever I attempt to invoke the externalized web service method, a new connection is being created instead of reuse the active one.
Note that the connection stays established for 10 seconds.
I made sure to use the following VM arguments (-Djava.endorsed.dirs=endorsed -Dhttp.keepAlive=true -Dhttp.maxConnections=20) and verified that the keep alive header is being set as part of the HTTP Request.
I am putting in the endorsed folder all the Metro 2.3 jars (webservices-api.jar, webservices-extra.jar, webservices-extra-api.jar, webservices-rt.jar, webservices-tools.jar) and doing that in order to insure that I operate with the 2.3 version and not with what comes in the JDK. (I am using JDK1.7.0_51 and JRE1.7)
What else should I be doing in order to be able to work with HTTP connection pool (over Metro JAX-WS 2.3)?
Thanks
Uri
Related
I am considering to implement a recommendation engine for a small size website.
The website will employ LAMP stack, and for some reasons the recommendation engine must be written in C++. It consists of an On-line Component and Off-line Component, both need to connect to MySQL. The difference is that On-line Component will need a connection pool, whereas several persistent connections or even connect as required would be sufficient for the Off-line Component, since it does not require real time performance in a concurrent requests scenario as in On-line Component.
On-line Component is to be wrapped as a web service via Apache AXIS2. The PHP frontend app on Apache http server retrieves recommendation data from this web service module.
There are two DB connection options for On-line Component I can think of:
1. Use ODBC connection pool, I think unixODBC might be a candidate.
2. Use connection pool APIs that come as a part of Apache HTTP server. mod_dbd would be a choice. http://httpd.apache.org/docs/2.2/mod/mod_dbd.html
As for Off-line Component, a simple DB connection option is direct connection using ODBC.
Due to lack of web app design experience, I have the following questions:
Option 1 for On-line Component is a tightly coupled design without taking advantage of pooling APIs in Apache HTTP server. But if I choose Option 2 (3-tiered architecture), as a standalone component apart from Apache HTTP server, how to use its connection pool APIs? A Java application can be deployed as a WAR file and contained in a servlet container such as tomcat(See Mahout in Action, section 5.5), is there any similar approach for my C++ recommendation engine?
I am not sure if I made a proper prototype.
Any suggestions will be appreciated:)
Thanks,
Mike
Is there any way by which the client machine or application settings restrict the number of connections it can open to a web service? So i have a .net application that spawns multiple threads and each thread creates new instance of the proxy to the web service XXX. On each thread i am calling SomeXXX method using the instantiated proxy. So if the service allows 100 connections and i am creating 100 threads is there any reason i should not see 100 established connections when i do netstat?
Regards
Ok,
So the setting in machine config restricts internet connection (http/https outside your machine) to 2 by default. Modify the System.Net section of machine config and it works great
<connectionManagement>
<add address="*" maxconnection="12"/>
</connectionManagement>
Regards
I have an application running in a Java EE App Server and it needs to call a web service of a partner company.
Using wsimport.exe from my JDK (1.6) I have generated the client classes. I instantiate the service and get the port in order to call the web service.
I noticed that the first call to the web service is slow, and I am led to believe this is because it is validating the WSDL. Subsequent calls are fast.
I could keep the WSDL locally, and apparently that will speed up the first call.
In order to optimise my app, I was thinking I could create a pool of the clients. This has the added advantage that I have some throttling in the app - lets say I have a pool of 5 clients, then at most I will be using memory for 5 clients. If the load increased suddenly on my server, I don't have to worry that an unlimited number of clients would cause an out of memory error. I am assuming, based on past experience, that the web service clients use a lot of memory...
Would you bother with a pool?
How would you get over the first call to the web service being slow?
What is the best way to create that pool, so that I have to do the least amount of programming (i.e. I'd like to use a library / API / whatever, so that I don't have to reinvent the wheel and code some hairy bugs).
The Apache Commons Pool might be exactly what I am after.
It is configurable and seems to have thought of everything.
A colleague of mine suggested that you can use the #WebServiceRef annotation on a field in an EJB. The idea is that the server would inject a reference to a client, from which one can create a port for each thread that calls the EJB.
I assume that injected references come from a pool, although the specification doesn't appear to talk about this. The Javadoc for the annotation explicitly mentions that:
"the injected references are not thread safe"
AKKA with a master/slave setup as shown in the link could work well, albeit a little more complex than the Apache Commons Pool listed in another answer. AKKA also uses an execution pool, with its own threads, which isn't strictly allowed in the Java EE world, although I'd argue that because a well tested framework is in charge of the threads, there is no danger, and it shouldn't interfere with the app servers control of threads anyway as the number of threads being handled by AKKA is minimal.
We provide couple of SOAP web service.
Yesterday our service was down, we couldn't access to the service from the outside (can't even load the wsdl), but we could access to the service if we were connected with terminal service on the server.
The thing is one of our partner was calling our web service with 130 simultaneous threads.
So I think the service was down because this partner was occupying all the available connection. And this limitation is done by .net because I can easily read static file (txt) on my server from the outside, and the service accept the connection if it's from the local IP.
Here is my question : how can I limit the simultaneous connection count for one client ? I know I can do it for every one in IIS Manager, I can do it for outgoing request (connectionmanagement configuration). But I can't find it for incoming request.
It's strange because I think it's one of the first thing I'd set to prevent DOS attack.
(.net 3.5 , IIS 6)
I have used the Java Wireless Toolkit Stub Generator to create a bunch of web service call stubs for a mobile app (BlackBerry J2ME app). The problem I'm having is that there doesn't appear to be any way to set a timeout on the calls. This causes the app to sit and wait for at least a minute waiting to timeout if the web service that is called is offline. I'd really like to set this timeout to something more manageable and then handle the offline situation.
The code generated uses javax.microedition.xml.rpc.Operation.Invoke to make the actual calls, but there is no timeout property anywhere that I can find.
There is no timeout property in standard jsr 172.
Try to set a timer to terminate connection thread if there was no response, handle exception and maintain offline case.