cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Commented] (CAY-1864) Process threads waiting for an available DB connection in the order they came in
Date Sat, 16 Nov 2013 08:19:23 GMT


Andrus Adamchik commented on CAY-1864:

On the Cayenne end , I am simply using JNDI variety of the DataSource. So it needs to be configured
and exposed via JNDI in your container. Don't have a handy Tomcat example, but it should be
easy to find. After all this pool is native to Tomcat. It just requires a <Resource>
declaration in the XML.

For Jetty we wrote a small factory class that I can share offline if needed.

> Process threads waiting for an available DB connection in the order they came in
> --------------------------------------------------------------------------------
>                 Key: CAY-1864
>                 URL:
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Core Library
>    Affects Versions: 3.2M1
>            Reporter: John Huss
>            Assignee: John Huss
>         Attachments: 0001-CAY-1864-Process-threads-waiting-for-an-available-DB.patch
> Currently when all the DB connections in the pool are used up threads will wait for available
connection.  As connections become available they are given to essentially random threads,
not the thread that was waiting first.  This causes somewhat erratic behavior since some requests
will come in and get a connection right away even though others have been waiting for a long
time, eventually causing more threads to throw exceptions than may have been necessary if
requests were processed in order.  
> Particularly in cases with large but brief spikes in activity - errors may be wholly
avoided if requests are processed in order where otherwise they could produce many failures.
 I have observed this in my testing.
> I have a patch I am testing out.  It creates a queue to keep track of the waiting threads
and then grant them connections in order.

This message was sent by Atlassian JIRA

View raw message