Thanks arron now it makes sense.  I actually tried what you said and
sure enough with each page that I loaded (based on my sitepage) I ended
up opening up more and more connections, not what I wanted.  But by
moving the DBPool out to the module level it works just like it is
supposed to (I actually give it its own module - just made more sense to
me)  Thanks again for setting me straight on this

Jose

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Aaron
Held
Sent: Tuesday, September 30, 2003 8:30 AM
To: jose
Cc: 'Webware discuss'
Subject: Re: [Webware-discuss] DBPool connections question


Each instance each page will now have a pool of 5 threads.

So if you have three pages all built on sitePage, and you have 10 
threads ruunning you will have (3*10*5) 150 possible connections, but 
you will only be able to use (3*5) 15 of them, since Webware creats one 
thread per request.

Move the self.db line to the module level in sitePage

db = DBPool.....
Class sitePage(Page):
  def writeContent(self):
      conn = db.getConnection.....

jose wrote:

>Hi all, I've got a quick question.  If I establish a dbpool connection 
>in my sitepage with say:
>
>Class sitePage(Page):
>       def __init__(self):
>               Page.__init__(self)
>               self.db = DBPool(MySQLdb, 5, user=user....)
>
>Instead of doing it in the context initialization, is there any real 
>problem to leaving the threads running?  I've noticed that most people 
>initialize dbpool with the context and have a application shutdown 
>method to close it down.  But since servlets stay in memory is this 
>really necessary?  Is there any harm in leaving them running (which is 
>what I am assuming will happen the way I've outlined doing it)?
>
>Thanks for the info in advance
>
>Jose
>
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf _______________________________________________
>Webware-discuss mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/webware-discuss
>  
>

-- 
-Aaron
http://www.MetroNY.com/
"I don't know what's wrong with my television set. I was getting  C-Span
and the Home Shopping Network on the same station.  I actually bought a
congressman."
    - Bruce Baum





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf _______________________________________________
Webware-discuss mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to