On Sat, 1 Nov 2003, Toad wrote:

> > Would it make sense to have freenet put a cap on the threads based on
> > available memory, similar to how it caps the routing table size based on
> > max connections?
> Perhaps, but how to calculate it?

I'd go with something relatively simple.  How many threads seems to work
with 128MB available? 256MB?  do a linear interpolation.  It seems
reasonable to assume there is a base + per-thread memory usage.  Another
option would be to query the JVM for available memory at regular
intervals, and use that as part of the load calculation.  If memory gets
too tight, start decreasing the max threads parameter.  Of course, I don't
know much about the freenet code and how easy that would be.  My
experience with other code is that OOMs are remarkably hard to recover
from, and so need to be avoided in advance.

Evan Daniel
Support mailing list

Reply via email to