Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

basic jvm question

Thread view: 
Marc E - 28 Apr 2006 00:53 GMT
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?
Chris Uppal - 28 Apr 2006 10:06 GMT
> 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
webdev - 28 Apr 2006 14:42 GMT
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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.