You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Jason Webb <jw...@inovem.com> on 2002/10/17 17:16:45 UTC

JDBC timeouts

I've been writing a mailet for a commercial MLM (as some of you might
know)

I seem to be having a problem whereby my mailet's DB connection is being
closed after a period of about 5 minutes. 5 minutes is NOT a long time
when you are sending an email to 50000 users... 

So, is there any way I can alter the timeouts in James (or Avalon) to
prevent timeouts from happening, or am I looking at re-writing my code?

I have altered the config.xml file to be the following:

<driver>org.gjt.mm.mysql.Driver</driver>
<dburl>jdbc:mysql://localhost/spider</dburl>
<pool-controller min="10" max="50" 
	connection-class="org.apache.james.util.mordred.PoolConEntry">

	<keep-alive disable="false">select 1</keep-alive>
</pool-controller>
<user>user</user>
<password>password</password>



-- Jason


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JDBC timeouts

Posted by "Noel J. Bergman" <no...@devtech.com>.
Jason,

Please let me know how it works for you.  :-)

If you are doing volume testing, be sure to check the mailing list for new
developments.  I put 1 million msgs through the SMTP handler last night.
The info from -verbosegc stablized around 5MB.  Resource levels are
definitely improved, although there might still be some things to deal with
(Peter Donald made some Excalibur thread pool fixes last night based upon
our findings, but I don't have a build with those fixes).  And we haven't
re-opened the spool, yet; we're isolated the SMTPhandler first.

	--- Noel

-----Original Message-----
From: Jason Webb [mailto:jw@inovem.com]
Sent: Friday, October 18, 2002 4:47
To: James Developers List
Subject: RE: JDBC timeouts


Thanks Noel - you're a complete hero!
We have some more serious volume testing to do on Monday, so I'll have to
wait until Monday morning (09:00 GMT) to do a comprehensive test.
However - I will have a play with it today - it's just that my home PC isn't
setup correctly, so I can't test it properly.

-- Jason

-----Original Message-----
From: Noel J. Bergman [mailto:noel@devtech.com]
Sent: 17 October 2002 19:08
To: James Developers List
Subject: RE: JDBC timeouts


Here is a modified JdbcDataSource.java.  It compiles, but has had zero
testing.  That's as much as I have had time for today.  Jason can try it,
and let us know if it helps.  Otherwise I'll play with it when I have more
time later.

	--- Noel

<snip'd>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JDBC timeouts

Posted by Jason Webb <jw...@inovem.com>.
Thanks Noel - you're a complete hero!
We have some more serious volume testing to do on Monday, so I'll have to
wait until Monday morning (09:00 GMT) to do a comprehensive test.
However - I will have a play with it today - it's just that my home PC isn't
setup correctly, so I can't test it properly.

-- Jason

-----Original Message-----
From: Noel J. Bergman [mailto:noel@devtech.com]
Sent: 17 October 2002 19:08
To: James Developers List
Subject: RE: JDBC timeouts


Here is a modified JdbcDataSource.java.  It compiles, but has had zero
testing.  That's as much as I have had time for today.  Jason can try it,
and let us know if it helps.  Otherwise I'll play with it when I have more
time later.

	--- Noel

<snip'd>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JDBC timeouts

Posted by "Noel J. Bergman" <no...@devtech.com>.
Here is a modified JdbcDataSource.java.  It compiles, but has had zero
testing.  That's as much as I have had time for today.  Jason can try it,
and let us know if it helps.  Otherwise I'll play with it when I have more
time later.

	--- Noel

-----Original Message-----
From: Serge Knystautas [mailto:sergek@lokitech.com]
Sent: Thursday, October 17, 2002 12:34
To: James Developers List
Subject: Re: JDBC timeouts


Noel J. Bergman wrote:
>>is there any way I can alter the timeouts in James (or Avalon) to
>>prevent timeouts from happening
>
>
> Not yet.  A change would be to remove the static final from the time limit
> members of the class, and add additional statements to the configure
method:
>
>   active_conn_time_limit =
> configuration.getChild("active-time-limit").getValueAsInteger(60000);
>   conn_idle_limit =
> configuration.getChild("idle-time-limit").getValueAsInteger(600000);
>
> such that we can say:
>
> 	<active-time-limit>xxxx</active-time-limit>
> 	<idle-time-limit>yyyy</idle-time-limit>
>
> This is pretty straightforward.  Do you want to affect the change on your
> end, test it, and submit it?
>
> 	--- Noel

Yeah, Mordred isn't great (embarassingly enough, I wrote it)...would be
nice to replace it with DBCP now that it's released, but that isn't
happening anytime soon.

I think that (those) extra configuration settings would be great,
specifically the active-time-limit.  That'd be a great patch if you can
submit it.

--
Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: JDBC timeouts

Posted by Serge Knystautas <se...@lokitech.com>.
Noel J. Bergman wrote:
>>is there any way I can alter the timeouts in James (or Avalon) to
>>prevent timeouts from happening
> 
> 
> Not yet.  A change would be to remove the static final from the time limit
> members of the class, and add additional statements to the configure method:
> 
>   active_conn_time_limit =
> configuration.getChild("active-time-limit").getValueAsInteger(60000);
>   conn_idle_limit =
> configuration.getChild("idle-time-limit").getValueAsInteger(600000);
> 
> such that we can say:
> 
> 	<active-time-limit>xxxx</active-time-limit>
> 	<idle-time-limit>yyyy</idle-time-limit>
> 
> This is pretty straightforward.  Do you want to affect the change on your
> end, test it, and submit it?
> 
> 	--- Noel

Yeah, Mordred isn't great (embarassingly enough, I wrote it)...would be 
nice to replace it with DBCP now that it's released, but that isn't 
happening anytime soon.

I think that (those) extra configuration settings would be great, 
specifically the active-time-limit.  That'd be a great patch if you can 
submit it.

-- 
Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JDBC timeouts

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I seem to be having a problem whereby my mailet's DB connection is being
> closed after a period of about 5 minutes. 5 minutes is NOT a long time
> when you are sending an email to 50000 users...

It would help if you posted the error message.  Are you getting the

   ***** connection XXX is way too old Y > L

message?

I'm not entirely sure that the approach being taken to connection pooling is
correct in that code, but that is only because the connection pools I've
written work differently.  Regardless, Mordred isn't going to change, at
least right now.  What COULD be done in the short term is add configuration
elements to allow the timeout parameters to be re-configured.

> is there any way I can alter the timeouts in James (or Avalon) to
> prevent timeouts from happening

Not yet.  A change would be to remove the static final from the time limit
members of the class, and add additional statements to the configure method:

  active_conn_time_limit =
configuration.getChild("active-time-limit").getValueAsInteger(60000);
  conn_idle_limit =
configuration.getChild("idle-time-limit").getValueAsInteger(600000);

such that we can say:

	<active-time-limit>xxxx</active-time-limit>
	<idle-time-limit>yyyy</idle-time-limit>

This is pretty straightforward.  Do you want to affect the change on your
end, test it, and submit it?

	--- Noel


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>