Thread: PyGres DB Connection in Zope drops when many Users are added (UserDB)

PyGres DB Connection in Zope drops when many Users are added (UserDB)

From
Stephan Richter
Date:
Hello everyone,

This is a help message to every mailing list, I think this issue could be
related to. We are in production and 5000 flyers (45000 follow) were sent
out and the site keeps giving problems.

I use:
Zope 2.1.4, PyGres 2.x, Apache, and PostGres 7.0RC1

The issue:
It seems like that whenever "many" (10, I know that is not much) people
sign up at the same time on our Web Site (http://www.plandepot.com), we
loose the DB connection. The connection is simple restored, when
disconnecting and the reconnecting the database.
Unfortunately I was unable to reproduce the error outside of business
hours, so I had never the chance to inspect the issue in detail. I
personally do not think it is PostGreSQL or Zope, since I would have read
more about it.
I have to mention, that PyGres is not thread safe and by default Zope uses
more than one thread if required. So could that be the issue? How do I
setup Zope in a way, that it uses only one thread? Also, I do not use any
of the caching features in Zope SQL Methods either.

Any ideas are appriciated.

THANK YOU ALL IN ADVANCE!!!

Regards,
Stephan
--
Stephan Richter - (901) 573-3308 - srichter@cbu.edu
CBU - Physics & Chemistry; Framework Web - Web Design & Development
PGP Key: 735E C61E 5C64 F430 4F9C 798E DCA2 07E3 E42B 5391


Have you tried running AB against some of the pages and watching the
connections happen? Also, try playing around with the cache. I found
that I could change the load times and db performance by playing with
Zope db caching.  I would also hate to mention it but 7 is still
beta. Can you try it on 6.5.3 and see if it still happens?

J


At 1:19 AM -0500 4/25/2000, Stephan Richter wrote:
>Hello everyone,
>
>This is a help message to every mailing list, I think this issue
>could be related to. We are in production and 5000 flyers (45000
>follow) were sent out and the site keeps giving problems.
>
>I use:
>Zope 2.1.4, PyGres 2.x, Apache, and PostGres 7.0RC1
>
>The issue:
>It seems like that whenever "many" (10, I know that is not much)
>people sign up at the same time on our Web Site
>(http://www.plandepot.com), we loose the DB connection. The
>connection is simple restored, when disconnecting and the
>reconnecting the database.
>Unfortunately I was unable to reproduce the error outside of
>business hours, so I had never the chance to inspect the issue in
>detail. I personally do not think it is PostGreSQL or Zope, since I
>would have read more about it.
>I have to mention, that PyGres is not thread safe and by default
>Zope uses more than one thread if required. So could that be the
>issue? How do I setup Zope in a way, that it uses only one thread?
>Also, I do not use any of the caching features in Zope SQL Methods
>either.

Stephan Richter wrote:
>
> Hello everyone,
>
> This is a help message to every mailing list, I think this issue could be
> related to. We are in production and 5000 flyers (45000 follow) were sent
> out and the site keeps giving problems.
>
> I use:
> Zope 2.1.4, PyGres 2.x, Apache, and PostGres 7.0RC1
>
> The issue:
> It seems like that whenever "many" (10, I know that is not much) people
> sign up at the same time on our Web Site (http://www.plandepot.com), we
> loose the DB connection. The connection is simple restored, when
> disconnecting and the reconnecting the database.

And that's exactly how we quick-fixed it :)

    def getUser(self, name):
        """Return the named user object or None if no such user exists"""
        try:      # koos elluäratamisega
            try:
                ob=self.sqlUserQuery(username=name)
            except:
                conn = getattr(self,self.conn_id)
                conn.connect(conn.connection_string)
                ob=self.sqlUserQuery(username=name)
        except:
            return None
        if not ob:
            return None
        ob=ob[0]
        return User(sqlattr(ob, 'username'),
                    sqlattr(ob, 'password'),
                    sqlattr(ob, 'roles'),
                    sqlattr(ob, 'domains'))

It does not find or solve the original problem, but at least it revives it
automatically


--------------
Hannu

At 06:21 AM 4/25/00 -0400, J. Atwood wrote:
>Have you tried running AB against some of the pages and watching the
>connections happen? Also, try playing around with the cache. I found that
>I could change the load times and db performance by playing with Zope db
>caching.  I would also hate to mention it but 7 is still beta. Can you try
>it on 6.5.3 and see if it still happens?

I am sorry, I should have mentioned: It originally occurred with PostGres
6.5.3.
What is AB? If everything fails, I will try the caching options. I just do
not want to introduce new variables to the game.

Regards,
Stephan
--
Stephan Richter - (901) 573-3308 - srichter@cbu.edu
CBU - Physics & Chemistry; Framework Web - Web Design & Development
PGP Key: 735E C61E 5C64 F430 4F9C 798E DCA2 07E3 E42B 5391