On Mar 12, 1:35 am, Dirkjan Bussink <[email protected]> wrote:
> On 11 Mar 2009, at 06:23, kristian wrote:
>
> > when I had a look in the pool implementation of the connection, I
> > really missed quite a few options I am used to see for these kind of
> > connections pooling:
> > * minimum/maximum pool size,
>
> I agree that this option should be easier to set. Right now the only
> way is overriding a method that returns the number of pooled
> connections.
>
> > * test query for testing the connection,
>
> mysql_ping is used to test whether the connection is alive / needs to
> reconnect. If this fails it can't reconnect automatically.
>
maybe mysql_ping and reconnect does the job for non jruby and mysql,
but step away from mysql, then how do you handle other databases:
postgresql, derby (java), hdbsql (java), orcale, etc
for example the orcale jdbc datasource (connection pool) does test the
connection with 'select 1 from dual'.
what does the pool with stale connections ? stale in the sense there
is some bug which renders such a connection unusable, or something
like this. the current pool keep the connection once it is created
until the server shuts down.
please have a look at various other (java) implementations:
https://test.kuali.org/confluence/display/KULRICE/Datasource+and+JTA+Configuration#DatasourceandJTAConfiguration
http://www.ibm.com/developerworks/opensource/library/os-ag-jdbc/ --
see listing1
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Database
Connection Pool (DBCP) Configurations
http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/ociconpl.htm#sthref1448
> > * none-blocking connection retrieval (the blocking retrieval caused
> > already deadlocks with me).
>
> How would it be non-blocking? Return nil for example when nothing is
> available would create really annoying problems in the calling code
> that needs to be able to handle these cases.
>
no the nil is not an good idea. but first have a look why I think the
pool should be non-blocking:
assume
* a pool size of 10
* the application can handle 1 request in 1 second
* the apache server forwards the incoming request to the application
(via passenger or mod_proxy or ..) and can process a 100 request
concurrently
now we can handle 10 concurrent requests per second. but let the load
rise to 11 concurrent requests per second an since the pool is
blocking you queue up 1 apache worker per second and after 1.5 minutes
the apache server refuses request with 'too many connections'
well this example is of theoretic nature and real live never looks to
uniform, but once the application gets more load then it can handle
you want to get the request "out" of the system as fast as possible
and for this the blocking pool is contra productive. in case the
apache is serving more than one application then the one blocking pool
takes even the other applications out of service.
better raise an exception, let it fall through to the error-controller/
error-handler and produce a nice little page saying 'sorry, system
overload'
and if people really want a blocking pool, then make it configurable.
> > I do not know how to reproduce the error BUT the frequency is NOT
> > acceptable for production.
>
> Well, if connections even drop during an active query, it would seems
> something way more serious is the problem. This would also mean that
> for example transactions could go wrong etc. I'm more on the fail
> early side here, so personally I'd try to isolate the exact problem
> and for example check whether a local setup experiences the same issues.
agreed, I should invest more on finding the cause. any hint how you
were able to reproduce the "MYSQL server gone away" problem, since I
was not able to find "reproducable case" !
>
> > if I can help somehow please let me know, any hints are welcome. if
> > you want to see the pool patches I happy to contribute them. but if
> > things remains like they are right now I go back to my above
> > workaround (after fixing the conncetion leak ;-)
>
> I'd love to see how you solved the issues you mentioned here and to
> possibly add them to extlib if they good fixes.
>
I will put the patches on lighthouse ?
with regards
Kristian
> --
> Regards,
>
> Dirkjan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---