Re: Howto: deploy socket server to linux
Tom Anderson wrote:
On Wed, 21 May 2008, j1mb0jay wrote:
Would running the socket application with the java MainClass - server
be better than just java.
It would run faster. It might use more memory. Whether it would be
'better' depends on how much those things matter to you.
Generally, though, -server is a good idea.
Agreed. The server program will run for a long time, months or years in many
enterprise systems, and serve many clients. Memory is usually a worthy
sacrifice in such scenarios - just pile on the gigabytes and boost -Xmx a lot,
go 64-bit, let's have a party. The tradeoff really is between throughput and
response time and reliability and scalability for most server applications.
Even for moderate-scale systems, the '-server' option helps performance,
though not necessarily throughput. It takes longer to optimize code than
client mode, and does often use more code memory, and its startup time is
worse, but all these things don't really matter for long-running processes
with enough memory. Typically applications run at roughly double speed in
server mode over client mode. YMMV. All that extra time taken to optimize
goes to good purpose - server mode is very good at digging up performance
improvements at runtime.
The architecture of your server determines what throughput options to
consider. The app's threading model, its memory usage profile, predictable
variations in load, how many processors are available - all and more figure in
the choice among the myriad of options to the JVM. If you do have a
multi-processor platform, look into the parallel garbage collector.
--
Lew