You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Evgeny Ryabitskiy (JIRA)" <ji...@apache.org> on 2010/07/12 09:58:52 UTC

[jira] Created: (CAY-1462) Refreshing connections in DataPool after DB restart

Refreshing connections in DataPool after DB restart
---------------------------------------------------

                 Key: CAY-1462
                 URL: https://issues.apache.org/jira/browse/CAY-1462
             Project: Cayenne
          Issue Type: Improvement
    Affects Versions: 3.0, 2.0 branch
         Environment: MS SQL
            Reporter: Evgeny Ryabitskiy
            Assignee: Evgeny Ryabitskiy
             Fix For: 2.0.5, 3.1M1


Problem can be simulated after restart of SQL Server.

So connection in my pool become "dead". Only thing that helps: restart my appllication.

I wold like to have some mechanism to validate pooled connections and refresh them.

Possible solutions:
1) validate before give connection from pool
2) asynchronous thread for validation.
3) Generate event for pool on such exceptions (to validate and refresh connections)

1- is more reliable but not sure how it will influence on performance...
2 - at least something... but can look like some not understandable magic... :)
3 - need some code investigation... 



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAY-1462) Refreshing connections in DataPool after DB restart

Posted by "Evgeny Ryabitskiy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887328#action_12887328 ] 

Evgeny Ryabitskiy commented on CAY-1462:
----------------------------------------

Thx, for your detailed explanation! Now it's much clear.

Guess we need to make some list of "Best Practice" to explain there solutions for such common problems.

I will try DBCP. 

One disadvantage is that there is validationQuery param that contains only one DB specific query.
For example I can use "select 1 from dual" for Oracle but it won't work on db2 or ms sql.... 
Still need some wrapping to determine DB type for validation query. 

> Refreshing connections in DataPool after DB restart
> ---------------------------------------------------
>
>                 Key: CAY-1462
>                 URL: https://issues.apache.org/jira/browse/CAY-1462
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 2.0 branch, 3.0
>         Environment: MS SQL
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>             Fix For: 2.0.5, 3.1M1
>
>
> Problem can be simulated after restart of SQL Server.
> So connection in my pool become "dead". Only thing that helps: restart my appllication.
> I wold like to have some mechanism to validate pooled connections and refresh them.
> Possible solutions:
> 1) validate before give connection from pool
> 2) asynchronous thread for validation.
> 3) Generate event for pool on such exceptions (to validate and refresh connections)
> 1- is more reliable but not sure how it will influence on performance...
> 2 - at least something... but can look like some not understandable magic... :)
> 3 - need some code investigation... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAY-1462) Refreshing connections in DataPool after DB restart

Posted by "Evgeny Ryabitskiy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Evgeny Ryabitskiy updated CAY-1462:
-----------------------------------

    Affects Version/s: 3.1M1
                           (was: 2.0 branch)
                           (was: 3.0)
        Fix Version/s:     (was: 2.0.5)

> Refreshing connections in DataPool after DB restart
> ---------------------------------------------------
>
>                 Key: CAY-1462
>                 URL: https://issues.apache.org/jira/browse/CAY-1462
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 3.1M1
>         Environment: MS SQL
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>             Fix For: 3.1M1
>
>
> Problem can be simulated after restart of SQL Server.
> So connection in my pool become "dead". Only thing that helps: restart my appllication.
> I wold like to have some mechanism to validate pooled connections and refresh them.
> Possible solutions:
> 1) validate before give connection from pool
> 2) asynchronous thread for validation.
> 3) Generate event for pool on such exceptions (to validate and refresh connections)
> 1- is more reliable but not sure how it will influence on performance...
> 2 - at least something... but can look like some not understandable magic... :)
> 3 - need some code investigation... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAY-1462) Refreshing connections in DataPool after DB restart

Posted by "Evgeny Ryabitskiy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887311#action_12887311 ] 

Evgeny Ryabitskiy commented on CAY-1462:
----------------------------------------

But we are using Cayenne's pool. And it is enough good even it's simple...
Looks like DBCP has something like 1 and 2 variants... Some day I will try it...

But still don't see anything bad in improving of Cayenn's pool. :)

> Refreshing connections in DataPool after DB restart
> ---------------------------------------------------
>
>                 Key: CAY-1462
>                 URL: https://issues.apache.org/jira/browse/CAY-1462
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 2.0 branch, 3.0
>         Environment: MS SQL
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>             Fix For: 2.0.5, 3.1M1
>
>
> Problem can be simulated after restart of SQL Server.
> So connection in my pool become "dead". Only thing that helps: restart my appllication.
> I wold like to have some mechanism to validate pooled connections and refresh them.
> Possible solutions:
> 1) validate before give connection from pool
> 2) asynchronous thread for validation.
> 3) Generate event for pool on such exceptions (to validate and refresh connections)
> 1- is more reliable but not sure how it will influence on performance...
> 2 - at least something... but can look like some not understandable magic... :)
> 3 - need some code investigation... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAY-1462) Refreshing connections in DataPool after DB restart

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887301#action_12887301 ] 

Andrus Adamchik commented on CAY-1462:
--------------------------------------

Evgeny, I suggest using DBCP connection pool that has query validation feature. Cayenne's own connection pool is intentionally very basic, as there are dozens of pool implementations out there (mostly bundled with app servers, but also standalone like Apache commons DBCP).

> Refreshing connections in DataPool after DB restart
> ---------------------------------------------------
>
>                 Key: CAY-1462
>                 URL: https://issues.apache.org/jira/browse/CAY-1462
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 2.0 branch, 3.0
>         Environment: MS SQL
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>             Fix For: 2.0.5, 3.1M1
>
>
> Problem can be simulated after restart of SQL Server.
> So connection in my pool become "dead". Only thing that helps: restart my appllication.
> I wold like to have some mechanism to validate pooled connections and refresh them.
> Possible solutions:
> 1) validate before give connection from pool
> 2) asynchronous thread for validation.
> 3) Generate event for pool on such exceptions (to validate and refresh connections)
> 1- is more reliable but not sure how it will influence on performance...
> 2 - at least something... but can look like some not understandable magic... :)
> 3 - need some code investigation... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAY-1462) Refreshing connections in DataPool after DB restart

Posted by "Andrus Adamchik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAY-1462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887315#action_12887315 ] 

Andrus Adamchik commented on CAY-1462:
--------------------------------------

> But we are using Cayenne's pool. And it is enough good even it's simple...
> Looks like DBCP has something like 1 and 2 variants... Some day I will try it...

It is very easy to switch. (Change to DBCPDataSourceFactory in the modeler and provide a config file)

> But still don't see anything bad in improving of Cayenn's pool. :) 

yeah, definitely if you want to work in this direction, you are more than welcome. Let me give you some history though to explain where I am coming from with my suggestion. Prior to Cayenne ca. 1.2 we advertised Cayenne connection pool as a standalone DataSource solution, but then relaized that a DataSource is something external and opaque to Cayenne, and from an ORM perspective it makes no sense for us to try to compete with other more advanced implementations (and a serious production-quality DataSource can get really complex, just look at home many parameters DBCP supports)... So we sort of limited the number of features that Cayenne pool supports (so that we can support them well without getting too distracted), and recommend DBCP for any advanced use.



> Refreshing connections in DataPool after DB restart
> ---------------------------------------------------
>
>                 Key: CAY-1462
>                 URL: https://issues.apache.org/jira/browse/CAY-1462
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 2.0 branch, 3.0
>         Environment: MS SQL
>            Reporter: Evgeny Ryabitskiy
>            Assignee: Evgeny Ryabitskiy
>             Fix For: 2.0.5, 3.1M1
>
>
> Problem can be simulated after restart of SQL Server.
> So connection in my pool become "dead". Only thing that helps: restart my appllication.
> I wold like to have some mechanism to validate pooled connections and refresh them.
> Possible solutions:
> 1) validate before give connection from pool
> 2) asynchronous thread for validation.
> 3) Generate event for pool on such exceptions (to validate and refresh connections)
> 1- is more reliable but not sure how it will influence on performance...
> 2 - at least something... but can look like some not understandable magic... :)
> 3 - need some code investigation... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.