How can I have my servlet accept 100 concurrent client requests?

          My servlet extends HttpServlet so it is multithreaded. Then I have written a java
          client which starts 100 concurrent threads that try to contact the servlet.
          There are always lots of threads which are refused by the Weblogic Server 6.0.
          They get a 'Connection refused' exception. Sometimes there are 50 refused connections,
          sometimes there are 0 refused connections (not very often), sometimes there are
          80 refused connections (usually).
          I have checked the 'Servlet' documentation and the 'J2EE Design Considerations
          for Weblogic Server' which recommends not to exceede the execute thread count
          number of 15. I have not changed that value, I do not even know if it still exists
          in Weblogic 6.0 as the document refers to the 5.0 version.
          Does anybody know how to solve this problem? How can I have the client requests
          waiting rather than being refused? Of course the main goal is to serve all the
          client requests, not to refuse.
          This is the code that the client thread uses to contact the servlet:
          URL url = new URL("http://localhost:7001/examplesWebApp/myServlet");
          URLConnection conn = url.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);
          DataOutputStream os = new DataOutputStream(conn.getOutputStream());
          os.writeBytes()
          os.writeBytes()
          Thanks for your time,
          David
          

          The key is
          KKEY_LOCALMACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters
          There you may need add a value "MaxUserPort" as REG_DWORD (5000 is default), also
          change "TcpTimedWaitDelay" to small number (30 is minimum). You may have trouble
          to find them. Just add them.
          You can also use Microsoft Web Application Stress Tool to test your Weblogic applications.
          As a free test tool, it is really powerful, although not so flexible.
          I guess you write your own test tool with java.net.URLConnection. I am not sure
          about the power of this class. In my case, I wrote my stress test tools with Java
          Socket. I can test application on Weblogic 6 with 1000 threads with my own tool
          and Microsoft tool, depending on memory and CPU of the machines I use. I run my
          tests on both Windows 2000 professional and Solaris.
          Check your CPU and memory usage with task manager.
          On the other hand, you should check log message on Weblogic 6. Try to turn on
          HTTP debug by add the following in your config.xml in tag <Server>.
          <ServerDebug DebugHttp="true" DebugURLResolution="true"
          JDBCConn="true" JDBCSQL="true" ListenThreadDebug="true" Name="myserver"/>
          "David Ruana" <[email protected]> wrote:
          >
          >Xiang, I really appreciate your help. I changed my Weblogic server configuration
          >from the console but I still experience the same problems.
          >
          >I start my 100 threads, and from about the 20th onward all them get the
          >'Connection
          >refused' exception in the URLConnection::getOutputStream() function,
          >always after
          >a successful URLConnection::openConnetion().
          >
          >My system is Windows 2000 Professional (Spanish version). I tried to
          >check the
          >open client socket descriptor limit but I was not able to find the TCPIP/MAXUSERPORT
          >in the registry. Do you know how is this entry called in Windows 2000?
          >
          >At this point I am not sure whether my problems are related to the Weblogic
          >server
          >or to the operative system. I will keep trying... I would appreciate
          >any other
          >suggestion.
          >
          >Thank you very much.
          >
          >
          >
          >"Xiang Rao" <[email protected]> wrote:
          >>
          >>It is better to use Weblogic 6 console to configure Weblogic server.
          >>In the console,
          >>there is tab Servers->myServer->Congiguration->Tuning, you can find
          >execute
          >>length
          >>and backlog.
          >>
          >>If you use Windows as test client, note Windows have a 5000 open client
          >>socket
          >>descriptors limit. You need change Windows Registry (TCPIP/MAXUSERPORT)
          >>to change
          >>this parameter.
          >>
          >>On the other hand, during test, you should monitor your test via Weblogic
          >>console
          >>(myServer->Monitoring->Performance), here you can see the change of
          >wait
          >>queue.
          >>If the queue keeps increaing, you are in trouble.
          >>
          >>Since you know how to use MBean, try to write customized (servlet, for
          >>example)
          >>to collect the following data: opened socket number, open socket number,
          >>opened
          >>session number and open session number. The two "open" numbers will
          >give
          >>you some
          >>clue. Also record your CPU and memory usage.
          >>
          >>BTW, what is the output you get from your test in terms of number of
          >>requests
          >>per second, response time and number of bytes downloaded/uplodaed per
          >>second?
          >>Are your test client and Weblogic running on the same machine?
          >>
          >>
          >>
          >>"David Ruana" <[email protected]> wrote:
          >>>
          >>>By the way, this is a piece of the config.xml file where you can see
          >>>my Server
          >>>configuration. It is the configuration which is installed in the examplesServer
          >>>in the free evaluation of Weblogic 6.0. I only modified the AcceptBacklog
          >>>value,
          >>>and added the ThreadPoolSize="15" line which was missing (I copied
          >from
          >>>the petstoreServer).
          >>>
          >>> <Server AcceptBacklog="1000" AdministrationPort="0" ClusterWeight="1"
          >>> ConsoleInputEnabled="false" DGCIdlePeriodsUntilTimeout="2"
          >>> DefaultProtocol="t3" DefaultSecureProtocol="t3s"
          >>> HttpdEnabled="true" JavaCompiler="C:\bea\jdk130/bin/javac"
          >>> ListenPort="7001" Name="examplesServer" NativeIOEnabled="true"
          >>>     ThreadPoolSize="15"
          >>> SocketReaderTimeoutMaxMillis="10"
          >>> TransactionLogFilePrefix="config/examples/logs/"
          >>> TunnelingClientPingSecs="45" TunnelingClientTimeoutSecs="40"
          >>>XMLRegistry="examplesXMLRegistry">
          >>> <ServerDebug Name="examplesServer"/>
          >>> <WebServer DefaultWebApp="DefaultWebApp_examplesServer"
          >>> LogFileName="./config/examples/logs/access.log"
          >>> LoggingEnabled="true" Name="examplesServer"/>
          >>> <Log FileName="./config/examples/logs/weblogic.log" Name="examplesServer"/>
          >>> <KernelDebug Name="examplesServer"/>
          >>> <SSL Enabled="true" ListenPort="7002" Name="examplesServer"
          >>> PeerValidationEnforced="0"
          >>> ServerCertificateChainFileName="./config/examples/ca.pem"
          >>> ServerCertificateFileName="./config/examples/democert.pem"
          >>> ServerKeyFileName="./config/examples/demokey.pem" TrustedCAFileName="./config/examples/ca.pem"/>
          >>> </Server>
          >>>
          >>>
          >>>
          >>>
          >>>
          >>>"Xiang Rao" <[email protected]> wrote:
          >>>>
          >>>>You only need to change Weblogic HTTP configuration. Give the server
          >>>>a big socket
          >>>>Backlog number. Since you test with 100 threads, you can think 1000
          >>>to
          >>>>5000, i.e.,
          >>>>1000 to 5000 requests will be in queue before got served. Aslo, you
          >>>might
          >>>>need
          >>>>to change your OS TCP/IP settings (both test clients and servers),
          >>such
          >>>>as maximum
          >>>>number of sockets and timeout value(so closed sockets will release
          >>socket
          >>>>descriptors
          >>>>immediately).
          >>>>
          >>>>On the other hand, the number of executive threads can be much larger
          >>>>than 15
          >>>>(50-200 is a normal number), depending on the features of your application.
          >>>>You
          >>>>can try your stress test tools to find a reasonable number by analyzing
          >>>>the relationships
          >>>>among (throughtput, response time, number of executive threads, etc).
          >>>>
          >>>>
          >>>>"David Ruana" <[email protected]> wrote:
          >>>>>
          >>>>>My servlet extends HttpServlet so it is multithreaded. Then I have
          >>>written
          >>>>>a java
          >>>>>client which starts 100 concurrent threads that try to contact the
          >>>servlet.
          >>>>>
          >>>>>There are always lots of threads which are refused by the Weblogic
          >>>Server
          >>>>>6.0.
          >>>>>They get a 'Connection refused' exception. Sometimes there are 50
          >>refused
          >>>>>connections,
          >>>>>sometimes there are 0 refused connections (not very often), sometimes
          >>>>>there are
          >>>>>80 refused connections (usually).
          >>>>>
          >>>>>I have checked the 'Servlet' documentation and the 'J2EE Design Considerations
          >>>>>for Weblogic Server' which recommends not to exceede the execute
          >thread
          >>>>>count
          >>>>>number of 15. I have not changed that value, I do not even know if
          >>>it
          >>>>>still exists
          >>>>>in Weblogic 6.0 as the document refers to the 5.0 version.
          >>>>>
          >>>>>Does anybody know how to solve this problem? How can I have the client
          >>>>>requests
          >>>>>waiting rather than being refused? Of course the main goal is to
          >serve
          >>>>>all the
          >>>>>client requests, not to refuse.
          >>>>>
          >>>>>This is the code that the client thread uses to contact the servlet:
          >>>>>
          >>>>>URL url = new URL("http://localhost:7001/examplesWebApp/myServlet");
          >>>>>URLConnection conn = url.openConnection();
          >>>>>conn.setDoInput(true);
          >>>>>conn.setDoOutput(true);
          >>>>>
          >>>>>DataOutputStream os = new DataOutputStream(conn.getOutputStream());
          >>>>>os.writeBytes()
          >>>>>os.writeBytes()
          >>>>>...
          >>>>>
          >>>>>Thanks for your time,
          >>>>>David
          >>>>>
          >>>>
          >>>
          >>
          >
          

Similar Messages

  • How can I change namespace prefix for JAX-RPC client request?

    I'm creating a JAX-RPC client to invoke a RPC/encoded web service. The service was generated from a ColdFusion program and for some reason when the SOAP namespace prefix is anything but "soapenv" it returns text/html instead of text/xml. Currently the client is sending requests with the prefix "env" and I'd like to change it to "soapenv".
    I created a type of javax.xml.rpc.handler.GenericHandler and attempted to do the follow:
    @Override public boolean handleRequest(MessageContext p1) {
         SOAPMessage msg = ((SOAPMessageContext) p1).getMessage(); 
         try {
              SOAPPart part = msg.getSOAPPart();
              SOAPEnvelope envelope = part.getEnvelope(); 
              envelope.setPrefix("soapenv"); 
              msg.saveChanges(); 
         } catch(SOAPException ex) {
              // TODO
              return false;
         return true;
    However I get the following exception:
    java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Server] FaultString [UNIMPLEMENTED ] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">java.lang.AssertionError: UNIMPLEMENTED
    at weblogic.xml.domimpl.NodeImpl.setPrefix(NodeImpl.java:173)
    at test.MyHandler.handleRequest(MyHandler.java:33)
    at weblogic.wsee.handler.JaxrpcHandlerChain.handleRequest(JaxrpcHandlerChain.java:58)
    at weblogic.wsee.ws.dispatch.server.JaxrpcChainHandler.handleRequest(JaxrpcChainHandler.java:102)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:141)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:107)
    at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:132)
    at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87)
    at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:341)
    at test.Approvedsuppliers_Wrap_Stub.echo(Approvedsuppliers_Wrap_Stub.java:31)
    at test.Approvedsuppliers_WrapPortClient.echo(Approvedsuppliers_WrapPortClient.java:130)
    at test.Approvedsuppliers_WrapPortClient.main(Approvedsuppliers_WrapPortClient.java:43)
    Is there any workaround? I appreciate any feedback.
    Thanks, Bill

    What I ended up doing is converting the SOAP message to a string, replacing the namespace prefix and converting it back to a SOAP message.
    @Override
       public boolean handleRequest(MessageContext messageContext) {
          SOAPMessageContext soapMessageContext = (SOAPMessageContext) messageContext;
          SOAPMessage soapMessage = soapMessageContext.getMessage();
          String soapString = convertSOAPToString(soapMessage);
          soapString = soapString.replaceAll("env:", "soapenv:");
          soapString = soapString.replaceAll("xmlns:env", "xmlns:soapenv");
          SOAPMessage newSoapMessage = convertStringToSOAP(soapString);
          MimeHeaders mimeHeader = newSoapMessage.getMimeHeaders();
          mimeHeader.setHeader("SOAPAction", "");
          soapMessageContext.setMessage(newSoapMessage);
          return true;
       private String convertSOAPToString(SOAPMessage soapMessage) {
          StringWriter stringWriter = null;
          try {
             stringWriter = new StringWriter();
             StreamResult streamResult = new StreamResult(stringWriter);
             TransformerFactory transformFactory = TransformerFactory.newInstance();
             Transformer transformer = transformFactory.newTransformer();
             transformer.transform(new DOMSource(soapMessage.getSOAPPart()), streamResult);
          } catch (TransformerException e) {
             throw new RuntimeException(e);
          } finally {
             close(stringWriter);
          return stringWriter.toString();   
       private SOAPMessage convertStringToSOAP(String soapString) {
          SOAPMessage soapMessage = null;
          ByteArrayInputStream byteInputStream = null;
          try {
             MessageFactory msgFactory = MessageFactory.newInstance();
             soapMessage = msgFactory.createMessage();
             SOAPPart soapPart = soapMessage.getSOAPPart();
             // Load the SOAP text into a stream source
             byte[] buffer = soapString.getBytes();
             byteInputStream = new ByteArrayInputStream(buffer);
             StreamSource source = new StreamSource(byteInputStream);
             // Set contents of message
             soapPart.setContent(source);       
          } catch (SOAPException e) {
             throw new RuntimeException(e);
          } finally {
             close(byteInputStream);
          return soapMessage;
       private void close(Closeable closeable) {
          if(closeable != null) {
             try {
                closeable.close();
             } catch (IOException e) {
                // TODO

  • How can I have a default servlet and an index.html?

    Hi,
    I writing a small webapp to test/understand the 2.2 Servlet Spec. I am deploying this as a WAR to Orion, Tomcat and Silverstream.
    The app's name is: "myapp"
    My application has an index.html, which is listed as the sole welcome-file in the welcome-file-list element in the app's web.xml.
    The interesting thing is that, after adding a default Servlet (<url-pattern>/</url-pattern>), I can no longer access the app's index.html either implicitly or explicitly:
    1. Implicit:
    - http://localhost/myapp
    - http://localhost/myapp/
    2. Explicit:
    - http://localhost/myapp/index.html
    - http://localhost/myapp/index.html/
    All of these invoke the Default Servlet in all 3 app servers.
    Question: How can I have both a default Servlet and an index page?
    Thanks in advance.
    Miles

    you can define it in the web.xml file
    look at the dtd, element "welcome-file-list"

  • How can I get iCloud to accept my working Apple ID and password

    My Apple ID and password works for iTunes and App Store.  I'm trying to set up iCloud on my iPhone and iPad but i keep getting an error message that reads unsupported ID.  Apple ID must be in the form of email address (@me.com).  I don't have a MobileMe account. How can I get iCloud to accept my working Apple ID and password?

    I've also reset my password to my Apple ID. I still get the Unsupported ID and password.

  • How can I let my servlet to process Chinese Character as an input?

    How can I let my servlet to process Chinese Character as an input to my simple database which is an Excel file. I have tried before and all my input values become question marks.
    Please give me some advise, thx!

    input chinese?����������
    that may result from the tomcat or other web server

  • How can I have popup text when user types something wrong?

    I have some textarea and textfields created dynamically. I have set of rules in a text file. How can I have these rules popup when users make mistakes(e.g., forgets to capitalize the name)?
    Please provide your input.
    Thx.
    M

    Mike
    From your addendum I'm guessing you are wanting to do this with a JSP or servlet. If so Ali's suggestion won't work becuase he's working with Swing components. It is always helpful if you specify the technology you're using: JDeveloper is a tool for writing many different types of Java programs.
    If you want to produce pop-up windows in JSP then you have to use JavaScript.
    If you're using DataWebBeans and want to use JavaScript you have to change (ie subclass) the WebBeans so that they have HTMLFieldRenderers that allow you to attach Javacript to a TextField (or whatever). This is not a small job but is worth it for the flexibility you'll gain.
    If you're using datatags I should imagine it's easier because you can add JavaScript functionality directly to the HTML input fields e.g. in the Input page, but I imagine you'll still have to subclass your own datatags to do the same for the Update pages.
    GoodLuck().youllNeedIt, APC
    null

  • How can i know the servlet is running or not?

    Hi all,
           I have a doubt regarding servlet. I created one servlet and deployed in server. Now i called (RUN) the servlet from the browser. And it is running. Now can i know that the servlet is running or not in the server without seeing in the browser. Can we know the status of the servlet with its URL in the server whether it is running or not?
             Let me explain my problem. In my servlet it will run continously read one table and  do some operation depending on the entries in that table. Now i called the servlet from the browser. After some time i closed the browser. If browser is there i can know whether servlet is running or not. But now how can i know that servlet is running or not. Becoz eventhough we closed the browser the servlet will run in the background. How can i achieve this?
    Thanks and Regards,
    VJR.

    Hi!
    With first call, the servlet will be loaded, and it remains so until server-shutdown, but you need a timer-mechanism execute method calls continuously.
    Regards,
    Thomas

  • How can I have multiple users on iTunes (in order to connect to a shared office iPad)?

    How can I have multiple users on iTunes (in order to connect to a shared office iPad)? Currently each of us has our own iTunes account, so I've made an "all office" Apple ID. However, I can't seem to get two different accounts (my personal and the office) to work on my machine. Even when I login as "the office", my personal library is still showing. Additionally, when I try to setup with a first-time use in iTunes, I get an error that I don't meet the minimum age requirement - no matter what birthdate I enter!

    The library exists regardless of which user is logged in.
    The only way around that is to create different user accounts on the computer.
    There is no way to have 20 unique iTunes users access a shared iTunes under a single login on the computer.

  • I have OSX Maverick on an iMac using Outlook e-mail.  PDF attachments are included in the e-mail  as the whole document rather than just the PDF icon.  How can i have just the PDF icon as an attachment?

    In Outlook my PDF attachments appear as whole documents and not just the PDF icon.  How can I have attachments included as PDF icons and not the documents?

    For your own viewing, you can of course control-click on the attachment and select "View as Icon".
    For others' viewing, it depends upon their email reader.  To ensure that attachments are not displayed expicitly you can put them all in a zip file (via control click and "Compress") then attaching them, or you can use third party stuff like Attachment Tamer.
    charlie

  • On my mac when i click on pages, a new document doesn't open instantly  but a window with my files open and then  have to click on the left bottom new document in order to open one. How can i have directly a new document when i click on pages icon

    On my mac when i click on pages, a new document doesn't open instantly  but a window with my files open and then  have to click on the left bottom < new document> in order to open one. How can i have directly a new document when i click on pages icon

    How to open an existing Pages document?
    Click Pages icon in the Dock to launch Pages.
    When Pages is open, click File menu in the  Pages menu bar.
    Select “Open”.
    When the select document  dialog box opens up, highlight/select the document and click “Open”
    at the bottom right corner of the dialog box.
    s
    https://support.apple.com/kb/PH15304?locale=en_US

  • How can I have two itunes accounts on one computer?

    How can I have two itunes accounts on one computer?

    Not sure what you mean.
    An account is a user name and password.
    Sign into whichever account you want to use for purchasing.
    Authorize the computer for both account to listen to the content.

  • How can I have two different windows up on one screen at the same time?

    How can I have to different windows open on my screen at one time? Kind of like a split or shared screen.

    If you want this split screen thingy for a single app, do like captfred suggests or see if the app itself supports some sort of splitting, like MS Excel.
    If you want to do this system-wide, maybe you can get what you want by activating and using Spaces: http://support.apple.com/kb/PH4313

  • How can I make the background one solid color?  It is too difficult and noticeable when I use the retouch button and try to erase all the creases in my backdrop.  So, how can I have just a solid white background?

    How can I make the background one solid color?  It is too difficult and noticeable when I use the retouch button and try to erase all the creases in my backdrop.  So, how can I have just a solid white background?

    When talking about a specific image posting the image may be useful.
    One can use a Layer Mask and add a white Layer underneath.

  • How can we have two different Itunes libraries on one computer?

    How can we have two Itunes accounts on one computer?  I found info on the itunes help page but I do not know how to follow the steps given because I am not prompted with what it says I should be prompted with? Please help I don't want to delete one of our libraries

    Launch iTunes with the Shift key held down as needed, or use different Windows XP user accounts.
    (74282)

  • How can I have multiple users on one apple id?

    How can I have multiple users on one apple ID?
    ie: I have my apple ID with my own credit, how can I set up credit for my son under the same apple ID, so that he can still access the same apps I've already downloaded and paid for?

    I've been trying to figure out a clean way to do this too. I think you may need more than one Apple ID – one that is shared and used to purchase "sharable" items and then "individual" Apple IDs for you and your son. That's the idea that I'm pursuing for the moment.
    It seems that there must be a way to do this, App Store purchases for the Mac are licensed across multiple machines. iPhone app purchases have "all your devices" licensing. Makes me think that Apple has a process in mind for sharing an account (or associating a device with multiple accounts).
    Other things I've learned:
    - Apparently you can't merge Apple ID accounts. I asked about this once at an Apple Store and was told that there was no way to do it.
    - If you share an Apple ID the Messages app behaves in a somewhat surprising manner. It must use your Apple ID to decide where messages should be sent because all users get all messages. This can make it very hard to organize a surprise party :-)

Maybe you are looking for

  • MX Electronic accounting - Set multiple UUID for single MIRO Document number

    Greetings everyone In my company already implemented the neccesary changes required by the new laws in MX Electronic Accounting inside the MIRO transaction (note 2093189), as well as the related notes requested for electronic accounting. Everything's

  • Looking for a headphones solution for 5th generation iPod

    So my headphone jack no longer works (technical problem). As a result I need headphones that plug in via the dock connector instead. A little over a year ago I bought (what I think was) a remote/headphones combo device that solved my problem. The rem

  • RMAN Backup in ORacle Apps R12

    Hi All, We have oracle Apps 12.0.4 installed.Ours is a small application and we are in implementation stage. As of now, we are taking regular backup of db (datafiles) using RMAN by scheduled cron jobs. I am looking for options to schedule the backups

  • How to use history.go(-1)  in JSF

    Hi All, I want to go back when click on Back button, I am doing , <h:commandButton value="Back" onclick="javascript:history.go(-1);"/> But back action is not firing .Any suggessions ? Thanks Sandip

  • How to customised web Report page?

    Hi, I am using Report Server 6i and I wish to customize the report parameter page and the result page so that I can add in buttons such as "close" and etc. Otherwise, the report pages always is covering the entire screen and my end users do now know