ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: ThrottledPool hanging
Date Mon, 15 Aug 2005 18:06:54 GMT
Well, blocking is what the throttled pool is intended to do. It should only 
block when the pool is exhausted though. Blocking alone isn't the problem. 
Blocking is a good thing when it is potentially releaving excessive strain 
on a particular resource (say a database). So ThrottledPool is meant to 
block. 

If you have incredible infrastructure, you could try increasing the maximum 
sessions to some enormous number.

BTW: Don't test using a for-loop with no idle time. Only test using a 
reasonably realistic user profile w/page timeouts. There's a HUGE difference 
between enterprise performance and for-loop execution times.

Cheers,
Clinton

On 8/15/05, Adam Gugliciello <AdamG@emeta.com> wrote:
> 
> FYI: The execution code looks like, not that according to the dump it A) 
> ever gets here or B) are there any running threads in the pool which should 
> be holding the synchronization object:
> 
> private static interface SqlMapTemplate
> {
> public void execute(SqlMapClient client) throws SQLException;
> }
> 
> executeSqlMapTemplate(new SqlMapTemplate()
> {
> public void execute(SqlMapClient client) throws SQLException
> {
> Map parameters = new HashMap();
> parameters.put("erightsUserId", new Integer(erightsUserId));
> parameters.put("groupingName", groupName);
> parameters.put("templateName", templateName);
> _log.debug("called, uid:" + erightsUserId + ", grp:" + groupName + ", 
> template:" + templateName);
> client.queryWithRowHandler("questionFindByGroup",
> parameters,
> new RowHandler()
> {
> public void handleRow(Object rowData)
> {
> QuestionRow row = (QuestionRow) rowData;
> try
> {
> _log.debug("Row found:" + row);
> doc.handleRow(row);
> }
> catch (IOException e)
> {
> String message =
> "Unable to write: "
> + e.getClass().getName()
> + " : "
> + e.getMessage();
> _log.error(message, e);
> throw new RuntimeException(message);
> }
> }
> });
> }
> });
> 
> ________________________________
> 
> From: Adam Gugliciello [mailto:AdamG@emeta.com]
> Sent: Mon 8/15/05 1:31 PM
> To: "<user-java"@ibatis.apache.org <http://ibatis.apache.org>
> Subject: RE: ThrottledPool hanging
> 
> 
> It doesn't actually take a minute to get the connection, it's just a safe 
> and reasonable timeout.
> 
> ________________________________
> 
> From: Clinton Begin [mailto:clinton.begin@gmail.com]
> Sent: Mon 8/15/05 1:19 PM
> To: user-java@ibatis.apache.org
> Subject: Re: FW:
> 
> 
> 
> Why does it take a minute to get a connection? With a connection pool, it 
> should literally be milliseconds....
> 
> Clinton
> 
> 
> On 8/15/05, Adam Gugliciello <AdamG@emeta.com> wrote:
> 
> Under a heavy sustained load, the sqlmaps ThrottledPool seems to start to 
> bind, the the vast majority of them binding up and blocking waiting to build 
> a new session, and stay blocked long after the fact, even days after the 
> request has been abandoned. Any help would be appreciated, and I am 
> attaching a thread dump.
> 
> My code looks like:
> 
> private void executeSqlMapTemplate(SqlMapTemplate t) throws SQLException
> {
> final Connection c =
> this._dbPool.borrowConnection("QuestionnaireCustomerApi",
> 1 * 60 * 1000l); // Waits a minute for a connection
> if (c == null)
> {
> throw new IllegalStateException("Unable to retrieve JDBC Connection from 
> db pool.");
> }
> try
> {
> SqlMapSession sess=this.sqlMapClient.openSession(c);
> t.execute(this.sqlMapClient);
> sess.close();
> 
> }
> finally
> {
> 
> this._dbPool.returnConnection(c);
> }
> }
> 
> 
> 
> 
> 
>

Mime
View raw message