Oleg wrote:
There are connections to different databases. So you said "one connection to one database"?
If you can use one connection string in Postgres to access multiple databases, then you just need one Database Connection. Otherwise, you'll need one connection per database. Note that I don't mean per table -- I don't know much about Postgres and don't know if it organizes tables into separate databases that are selected with a "use database" command.
It is bad, as I have many databases, so Zope eats up memory. Another problem - what would do Zope if I restart Postgres (so all current connections break)? Would Zope reestablish connections or just report error?
It should re-establish the connection. If it doesn't then there's a bug. This works fine with all the Database Adapters I've used.
I'll retest, but currently, when I ask ZPygresDA to close connection, Zope reports "the site has technical difficulties" when I'm trying to access the application.
Right, which is the correct behavior, as you had disconnected from the database. I thought your question was about restarting _Zope_, so I had a misunderstanding. I don't know anything about the Postgres client library and whether it can reconnect to a server when the server is shutdown. This definately isn't a Zope issue though -- the client should handle it. --Paul
On Tue, 23 Mar 1999, Paul Everitt wrote:
Oleg wrote:
There are connections to different databases. So you said "one connection to one database"?
If you can use one connection string in Postgres to access multiple databases, then you just need one Database Connection. Otherwise,
No. Connection string include database name, so I need one connection for every database.
you'll need one connection per database. Note that I don't mean per table -- I don't know much about Postgres and don't know if it organizes tables into separate databases that are selected with a "use database" command.
Yes, I see.
It is bad, as I have many databases, so Zope eats up memory. Another problem - what would do Zope if I restart Postgres (so all current connections break)? Would Zope reestablish connections or just report error?
It should re-establish the connection. If it doesn't then there's a bug. This works fine with all the Database Adapters I've used.
I'll retest, but currently, when I ask ZPygresDA to close connection, Zope reports "the site has technical difficulties" when I'm trying to access the application.
Right, which is the correct behavior, as you had disconnected from the database. I thought your question was about restarting _Zope_, so I had a misunderstanding.
I meant 3 different situations: 1. I started Potsgres, then started Zope, then restarted Zope - Zope reestablished connections. It's Ok. 2. I started Potsgres, then started Zope, then restarted Postgres. Zope does not reestablish connections: This site is currently experiencing technical difficulties... 3. I started Potsgres, then started Zope, then went to management screen and explicitly close a connection. Zope does not reestablish connections. Situations 2 an3 could be resolved, if I go to management screes, close and reopen database connections. But it is hard to remember "always restart Zope if you restart Postgres"...
--Paul
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
On Tue, Mar 23, 1999 at 07:07:42PM +0300, Oleg Broytmann wrote:
1. I started Potsgres, then started Zope, then restarted Zope - Zope reestablished connections. It's Ok.
Ok, so we don't have a problem here :-)
2. I started Potsgres, then started Zope, then restarted Postgres. Zope does not reestablish connections: This site is currently experiencing technical difficulties...
I agree that if a remote cause forces a database connection to close, it should attempt to re-open it... that should be optional of-course, but should be the default.
3. I started Potsgres, then started Zope, then went to management screen and explicitly close a connection. Zope does not reestablish connections.
Nope, you closed the connection, you have to open it. This I agree is the appropriate way to behave. Chris -- | Christopher Petrilli ``Television is bubble-gum for | petrilli@amber.org the mind.''-Frank Lloyd Wright
On Tue, 23 Mar 1999, Christopher Petrilli wrote:
On Tue, Mar 23, 1999 at 07:07:42PM +0300, Oleg Broytmann wrote:
1. I started Potsgres, then started Zope, then restarted Zope - Zope reestablished connections. It's Ok.
Ok, so we don't have a problem here :-)
Good news! :)))
2. I started Potsgres, then started Zope, then restarted Postgres. Zope does not reestablish connections: This site is currently experiencing technical difficulties...
I agree that if a remote cause forces a database connection to close, it should attempt to re-open it... that should be optional of-course, but should be the default.
Yes, I think Zope must reopen connection.
3. I started Potsgres, then started Zope, then went to management screen and explicitly close a connection. Zope does not reestablish connections.
Nope, you closed the connection, you have to open it. This I agree is the appropriate way to behave.
May be... Well, what about such situation: 4. I started Potsgres, then started Zope, then worked with my application and Postgres failed (postgres fails sometimes). Postgres returned an error and closed connection. Zope, I think, should reopen the connection back, but will it?
Chris -- | Christopher Petrilli ``Television is bubble-gum for | petrilli@amber.org the mind.''-Frank Lloyd Wright
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
On Tue, Mar 23, 1999 at 07:34:12PM +0300, Oleg Broytmann wrote:
I agree that if a remote cause forces a database connection to close, it should attempt to re-open it... that should be optional of-course, but should be the default.
Yes, I think Zope must reopen connection.
Well, actually it should be the job of the DA, not Zope. It's not spelled out in a standard anywhere, which probably should be solved. More documentation probably :/ But hey, someone's gotta know what the DA is really supposed to do, other than looking at an existing one.
Well, what about such situation:
4. I started Potsgres, then started Zope, then worked with my application and Postgres failed (postgres fails sometimes). Postgres returned an error and closed connection. Zope, I think, should reopen the connection back, but will it?
Don't honestly know if it WILL, but it seems reasonable that it should be capable of trying at the very least. Again, this is the responsibility fo the DA, not Zope... that should be made clear. You're using a 3rd party DA, so you might want to talk to them about it as well. Chris -- | Christopher Petrilli ``Television is bubble-gum for | petrilli@amber.org the mind.''-Frank Lloyd Wright
Hello. Continuing the subject... Next question. If Zope opens one connection to a database, how does Zope manage concurrency? Currently, when two CGIs run in parallel, every CGI opens its own connection to the database, lock neccessary tables, and Postgres manage concurrency very good (even detecting deadlocks). Next Postgres version (6,5) will have Multi-version Concurrency Control. But all this is for different sessions. Zope opens only one session. Is it a problem with concurrency? Oleg. ---- Oleg Broytmann http://members.xoom.com/phd2/ phd2@earthling.net Programmers don't die, they just GOSUB without RETURN.
At 10:59 26/03/99 , Oleg Broytmann wrote:
Hello.
Continuing the subject... Next question. If Zope opens one connection to a database, how does Zope manage concurrency? Currently, when two CGIs run in parallel, every CGI opens its own connection to the database, lock neccessary tables, and Postgres manage concurrency very good (even detecting deadlocks). Next Postgres version (6,5) will have Multi-version Concurrency Control. But all this is for different sessions. Zope opens only one session. Is it a problem with concurrency?
Zope manages concurrency by being single-threaded... so only one query at a time, on ANY connection... -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
On Fri, 26 Mar 1999, Martijn Pieters wrote:
Zope manages concurrency by being single-threaded... so only one query at a time, on ANY connection...
What about ZServer? It will be single-threaded too? Isn't it possible to run Zope multithreaded?
-- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
At 13:01 26/03/99 , Oleg Broytmann wrote:
On Fri, 26 Mar 1999, Martijn Pieters wrote:
Zope manages concurrency by being single-threaded... so only one query at a time, on ANY connection...
What about ZServer? It will be single-threaded too? Isn't it possible to run Zope multithreaded?
Not yet. ZServer is multithreaded, but Zope itself isn't. This is because the BoboPOS (cuurent version 2) doesn't support concurrent access. The all new ZODB 3 will support this, and then Zope can (will?) become multithreaded as well. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
On Fri, 26 Mar 1999, Martijn Pieters wrote:
Not yet. ZServer is multithreaded, but Zope itself isn't. This is because the BoboPOS (cuurent version 2) doesn't support concurrent access. The all new ZODB 3 will support this, and then Zope can (will?) become multithreaded as well.
So I have some time before I'll see problems with concurrent access to SQL server! :)
-- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
On Tue, 23 Mar 1999, Oleg Broytmann wrote:
On Tue, 23 Mar 1999, Paul Everitt wrote:
Oleg wrote:
There are connections to different databases. So you said "one connection to one database"?
If you can use one connection string in Postgres to access multiple databases, then you just need one Database Connection. Otherwise,
No. Connection string include database name, so I need one connection for every database.
Connection strings for MySQL also require you to include the database, but you can still change databases at runtime via the 'use <database>' command. --- John Eikenberry [jae@kavi.com - http://taos.kavi.com/~jae/] ______________________________________________________________ "A society that will trade a little liberty for a little order will deserve neither and lose both." --B. Franklin
participants (5)
-
Christopher Petrilli -
John Eikenberry -
Martijn Pieters -
Oleg Broytmann -
Paul Everitt