Servlet Question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Servlet Question

  1. #1
    JohnSmith Guest

    Servlet Question

    Hi,

    I have a servlet that implements SingleThreadModel, as I indicated below.
    public class interactToDatabase extends HttpServlet implements
    javax.servlet.SingleThreadModel

    My question is, would implementing SingleThreadModel will greatly affect the
    performance of the Servlet because I will have a 200-500 client that will
    connect to the server and run this servlet.

    Thanks for any help.



  2. #2
    Paul Clapham Guest

    Re: Servlet Question

    That's impossible to answer without knowing a whole lot of statistical
    things such as: how long does each call to the servlet take, how often will
    users access it, and you need averages and distributions of those factors
    and an M.Sc. in queueing theory to figure it out.

    But you can use the BOTE (back of the envelope) method... for example
    suppose your servlet takes 10 seconds to run, and each of your 500 users
    accesses it once per day, some time in an 8-hour period. Then you have
    about 1 access per minute (8 hours = 480 minutes) and only 10 seconds used,
    so if the accesses are spread out evenly you don't have a problem. But if
    everybody wants to use it at lunch time, then you do have a problem.

    So take your actual estimates for those parameters, grab an envelope, and
    have a try. The harder calculation is, what if you weren't single-threading
    those requests? Good luck.

    PC2

    "JohnSmith" <any@email.com> wrote in message
    news:3afc40fb$1@news.devx.com...
    > Hi,
    >
    > I have a servlet that implements SingleThreadModel, as I indicated below.
    > public class interactToDatabase extends HttpServlet implements
    > javax.servlet.SingleThreadModel
    >
    > My question is, would implementing SingleThreadModel will greatly affect

    the
    > performance of the Servlet because I will have a 200-500 client that will
    > connect to the server and run this servlet.
    >
    > Thanks for any help.
    >
    >




  3. #3
    dlorde Guest

    Re: Servlet Question


    You should be aware that implementing SingleThreadModel does not mean that
    you can safely write servlet code that isn't re-entrant. Although it gives
    you a single-threaded servlet, static class variables and classes outside
    the scope of the servlet will not be thread safe. This tends to make implementing
    SingleThreadModel for any non-trivial servlet more dangerous than biting
    the bullet and writing thread-safe code.

    "JohnSmith" <any@email.com> wrote:
    >Hi,
    >
    >I have a servlet that implements SingleThreadModel, as I indicated below.
    > public class interactToDatabase extends HttpServlet implements
    >javax.servlet.SingleThreadModel
    >
    >My question is, would implementing SingleThreadModel will greatly affect

    the
    >performance of the Servlet because I will have a 200-500 client that will
    >connect to the server and run this servlet.
    >
    >Thanks for any help.
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center