-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Peter,

Peter Crowther wrote:
> The messy way: Run Tomcat as an admin (ick!) and make a JNI call to
> some native code that pins Tomcat's address space into RAM.

Messy indeed.

> I have not tried this, don't know whether there's a "correct" JVM way
> of doing it, and have *no* idea how it might interact with Sun's
> address space management!  It's something to try very, very
> cautiously - this might bite you in unexpected ways.

My experience with JNI is that you have to pin objects one at a time.
Since Tomcat manages millions of objects, I'm not sure how you'd do this
effectively. Also, I believe that pinning an object does more than make
is non-relocatable within the heap (see below); I think that if you
pinned objects indefinitely, Bad Things would probably happen. One Bad
Thing that will probably happen is that objects will never be tenured,
and you'll fill up other parts of your heap with objects that ought to
be promoted to more long-lasting areas of the heap.

Finally, pinning an object has no bearing on its "pagability"... it just
means that a native pointer can be used to access it, and the memory
address where the object can be found won't change until it's unpinned.
The memory can still be swapped to disk, as long as the memory address
for that object does not change. Heck, it can even be relocate in
physical memory of the OS wants to do it (which it probably will do
during paging), as long as the process can always use that same pointer
to access the object.

I'd imagine that most OSs have functions to /actually/ pin data into
memory (making is non-pagable). In order to do that, you'd have to
Java-pin the object, then OS-pin the memory. I think that's going to
cause lots more problems than a long wait for the first request of the
day ;)

I actually favor your "cheap way" since it's super simple and likely to
work just as well ;)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHDN9X9CaO5/Lv0PARAhPhAKCfmYrgUs1/4dhdkDtC8k26K32CdQCfZ56H
OPkbbsDv9mtnMGRDMejdjFw=
=cOdy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to