UniverseUniversity


Home Projects Jobs Clientele Contact

uu


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UU code



Yes, if the db and app servers are on different machines.
And if our initial pool implementation is noop, we get best
of both worlds.

Alexey Parshin wrote:
> Actually, postgres connection is somewhat around 50ms. Does it worth
> to create a connection pool then?
>
> 2007/3/14, Ilya A. Volynets-Evenbakh < ilya@total-knowledge.com
> <mailto:ilya@total-knowledge.com>>:
>
>     Correct. We _could_ optimize it a bit by hooking up session
>     IDs with that, but I am not sure it's worth the effort for now.
>
>     In our particular case, we could simplify and abstract our code
>     a bit by making connection pool itself take care of that.
>     I.E. function that would return connection from pool, would
>     have to take application user credentials of some form.
>
>     Alexey Parshin wrote:
>     > Please, remember, that security is connection-specific. If we gonna
>     > implement connection pooling - then the first operation on every
>     page
>     > should be login(username,password).
>     >
>     > 2007/3/14, Ilya A. Volynets-Evenbakh < ilya@total-knowledge.com
>     <mailto:ilya@total-knowledge.com>
>     > <mailto: ilya@total-knowledge.com
>     <mailto:ilya@total-knowledge.com>>>:
>     >
>     >     Yes to CDatabase vs. CODBCDatabase.
>     >     No to connection per session.
>     >     High volume web applications cannot do that, since there are
>     >     usually many many more inactive sessions, then sessions
>     >     actually accessing database at any given time.
>     >
>     >     The correct way to do it is to have database connection pool.
>     >     Database connections are retrieved from it and returned when
>     >     they are used. No database connection is guaranteed to preserve
>     >     state between requests. Luckily we do not have complex
>     transactions
>     >     that span more then one request and could be rolled back in any
>     >     sane manner.
>     >
>     >     Alexey Parshin wrote:
>     >     > Also, it isn't enough to have db handle to work with the
>     >     database. We
>     >     > (in ideal case) should have CDatabase object staying alive
>     >     through the
>     >     > whole session. I'm not sure - where to keep it, but it
>     shoul be
>     >     > connected with the session data. Does it make sense?
>     >     >
>     >     > 2007/3/14, Ilya A. Volynets-Evenbakh
>     <ilya@total-knowledge.com <mailto:ilya@total-knowledge.com>
>     >     <mailto: ilya@total-knowledge.com
>     <mailto:ilya@total-knowledge.com>>
>     >     > <mailto: ilya@total-knowledge.com
>     <mailto:ilya@total-knowledge.com>
>     >     <mailto: ilya@total-knowledge.com
>     <mailto:ilya@total-knowledge.com>>>>:
>     >     >
>     >     >     No.
>     >     >
>     >     >     sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>
>     >     <mailto: sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>>
>     >     <mailto:sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>
>     >     <mailto:sergey@total-knowledge.com
>     <mailto:sergey@total-knowledge.com>>> wrote:
>     >     >     >> Servlet has a virtual init() method, that you can
>     override.
>     >     >     There you
>     >     >     >> can create your pool instance and store it in
>     ServletContext
>     >     >     attribute.
>     >     >     >>
>     >     >     >
>     >     >     > In order to do that my libdm' uudb class should extend
>     >     >     HttpServlet and be
>     >     >     > servlet itself. Is it right way to do it?
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >     >> --
>     >     >     >> Ilya A. Volynets-Evenbakh
>     >     >     >> Total Knowledge. CTO
>     >     >     >> http://www.total-knowledge.com
>     >     <http://www.total-knowledge.com>
>     >     >     >>
>     >     >     >>
>     >     >     >>
>     >     >     >
>     >     >     >
>     >     >     >
>     >     >
>     >     >     --
>     >     >     Ilya A. Volynets-Evenbakh
>     >     >     Total Knowledge. CTO
>     >     >     http://www.total-knowledge.com
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > --
>     >     > Alexey Parshin,
>     >     > http://www.sptk.net < http://www.sptk.net>
>     >
>     >     --
>     >     Ilya A. Volynets-Evenbakh
>     >     Total Knowledge. CTO
>     >     http://www.total-knowledge.com
>     >
>     >
>     >
>     >
>     > --
>     > Alexey Parshin,
>     > http://www.sptk.net
>
>     --
>     Ilya A. Volynets-Evenbakh
>     Total Knowledge. CTO
>     http://www.total-knowledge.com
>
>
>
>
> -- 
> Alexey Parshin,
> http://www.sptk.net 

-- 
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com


Authoright © Total Knowledge: 2001-2008