> if code is sitting on machine A, like on a NAS device, and server B is the
> java server that actually runs that code, is there a performance penalty
> for server B running it from the NAS as opposed to putting the code
> physically on server B and running it from there?
There should not be a significant penalty, maybe none at all.
The code has to be fetched from the NAS device, which might be a bit slower
than reading the local disk (or maybe it would be faster), but once it has been
read, the data on-disk is no longer needed so there is no ongoing performance
impact.
Actually, the code is fetched piecemeal -- as each class is needed, its
definition is loaded. So the JVM may read the data off-disk in a
not-very-sequential manner. I suppose it is possible that a NAS device might
have been optimised to handle sequential reads significantly better than
random-access, in which case the code-loading wouldn't be as fast as you might
expect from reading the NAS device's spec-sheet (but when is that /ever/ true ?
;-) But it would still not be an ongoing performance hit, it would just take
longer for the app to start up (like starting up from a fragmented local disk).
-- chris
If you use NAS as storage, i don't think it is a performance problem to
put the code in it and run on other server.
Marc E - 28 Apr 2006 20:21 GMT
so let me get this straight: let's say i have a thousand requests to
index.jsp. index.jsp creates an instance of class Foo for each request and
calls foo.doSomething(). what you're saying is that that doSomething() is
read from disk only once.
true?
> If you use NAS as storage, i don't think it is a performance problem to
> put the code in it and run on other server.
Matt Humphrey - 28 Apr 2006 20:50 GMT
> so let me get this straight: let's say i have a thousand requests to
> index.jsp. index.jsp creates an instance of class Foo for each request and
> calls foo.doSomething(). what you're saying is that that doSomething() is
> read from disk only once.
>
> true?
Yes. To supplement Chris' answer, the first piece of code that mentions the
class Foo causes the code of Foo to be loaded into the JVM, where it stays.
No matter how many Foo object instances you have, only one copy of the class
is needed in memory.
Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/