tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saur...@cysphere.com (Saurabh Shukla)
Subject RE: Increasing memory problem (i hope this helps)
Date Tue, 28 Nov 2000 14:45:42 GMT


>could you tell me more about the thread pooling, please? Where do I get
some
>information? How does Tomcat handle the requests?

>Thank you.

>Kai

I hope this helps.

The PROBLEM:
Tomcat is a multi-threaded servlet container, this means that the requests
needs to be executed by some thread, when a new requests arrives a new
thread
starts and serves the request. This is very problmatic coz' of this it is
hard
to limit the resource consumptio, i.e if 300 requests arrive concurrently
tomcat will open 300 threads and serve them, this causes tomcat to allocate
more resources(CPU, memory,..) than it should and leads to low performance
and
crashes.(for that matter memory problems with Oracle were coz' of this).

THE SOLUTION: Having a thread pool, instead of allocating new threadsl
whenvever they need a thread they ask for it from the pool and and when they
are done
the thread is returned to the pool. Thread management techniques such as:

1) Keeping threads open and reusing them over and over again, this saves
trouble associated with creating and destructing threads continuously.

2) setting an upper bound on the number of concurrent threads used, this
solves the resource allocation problem.


Shuklix
----------------------------------------------------------------------------
----

Ps: This is a excerpt from a write up which i had read,  had kept this
    a small write up for my reference.   Sorry author for not being able to
give
    you due credit.
----------------------------------------------------------------------------
----
Hello Shuklix,

could you tell me more about the thread pooling, please? Where do I get some
information? How does Tomcat handle the requests?

Thank you.

Kai

Saurabh Shukla wrote:

> YOu can also try Thread Pooling in tomcat, it might be help.
>
> SHuklix
>
> -----Original Message-----
> From: Julio Serje (@canada.com) [mailto:jserje@home.com]
> Sent: Sunday, November 26, 2000 10:08 PM
> To: tomcat-user@jakarta.apache.org; km@mediadom.de
> Subject: Re: Increasing memory problem
>
> Hi, Kai.
>
> The problem you are experiencing is a difficult one, as it relates to the
> way you allocate and de-allocate your resources in a way the garbage
> collector can determine that a resource is not needed anymore.
>
> You say that you're using jdbc. You should make sure that you are properly
> (and explicitly) deallocating all resources you create.
>
> a) Connections to the database. If you're not using a connection pool,
make
> sure your connections are closed.
> b) ResultSets AND statements. This is a common problem, you must close()
> them in order to let the garbage collector do its work.
> example:
> rset.close();
> stmt.close();
> conn.close();
>
> Julio
>
> ----- Original Message -----
> From: Kai Müller <km@mediadom.de>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Friday, November 24, 2000 12:35 PM
> Subject: Increasing memory problem
>
> > Hi everybody!
> >
> > My problem is the following:
> >
> > after I start my application (JSPs read from MySQL) with Tomcat 3.1 the
> > used memory of the java processes increases and the number of java
> > processes themselves increases if I reload the same site (2 per second),
> > reload, reload, reload .... ;-)
> >
> > The performance goes down, and sometimes Tomcat crashes. The HTML sent
> > to the browser is large (about 350 kB). I get several errors
> > (OutOfMemory, Response has already been committed,...) and I am
> > absolutely confused about it now.
> >
> > Can anybody help me ? Do you need further information ?
> >
> > With kind regards
> >
> > Kai Müller
> >
> >
> > The input.jsp is the following and a global entry for all requests,
> > which are handled and forward on a JSP page with the HTML-Codes.
> >
> > ----------------------------------------------------
> > <%@ page errorPage="/error/errorpage.jsp" %>
> > <%@ page import="javax.servlet.*" %>
> > <%@ page import="javax.servlet.http.*" %>
> >
> > <%
> >    response.setDateHeader("Expires",0);
> >    response.setHeader("Pragma","no-cache");
> >    response.setHeader("Cache-Control","no-cache,must-revalidate");
> > %>
> >
> >  <jsp:useBean
> >    id="requestProc"
> >    class="TheRequestClass"
> >    scope="session"
> >  >
> > <%
> >      requestProc.initialize(config.getServletContext(), session);
> >  %>
> > </jsp:useBean>
> >
> >  <jsp:useBean
> >    id="pageController"
> >    class="ThePageControllerClass"
> >    scope="session"
> >  >
> > </jsp:useBean>
> >
> >
> >  <%
> >    requestProc.processRequest(request);
> >
> >    String next = pageController.getNextPage(request);
> >    getServletConfig().getServletContext().getRequestDispatcher("/" +
> > next).forward(request, response);
> >  %>
> > -----------------------------------------------------
> > --
> >
> > Mediadom audiovisuelle Medien GmbH
> > Merheimer Str. 151
> > D-50733 Koeln
> >
> > Tel.: 0221 / 917 11 80
> > Fax: 0221 / 917 11 81
> >
> > Internet: http://www.mediadom.de
> >
> >

--

Mediadom audiovisuelle Medien GmbH
Merheimer Str. 151
D-50733 Koeln

Tel.: 0221 / 917 11 80
Fax: 0221 / 917 11 81

Internet: http://www.mediadom.de



Mime
View raw message