Theadvantage of multiple processes is that legacy applications that are not thread-aware or
thread-safecan be run more eectively in Sun Java System Web Server. However, because all of
theSun Java System extensions are built to support a single-process threaded environment, they
mightnot run in the multi-process mode. The Search plug-ins fail on startup if the server is in
multi-processmode, and if session replication is enabled, the server will fail to start in
multi-processmode.
Inthe multi-process mode, the server spawns multiple server processes at startup. Each process
containsone or more threads (depending on the conguration) that receive incoming requests.
Sinceeach process is completely independent, each one has its own copies of global variables,
caches,and other resources. Using multiple processes requires more resources from your
system.Also, if you try to install an application that requires shared state, it has to synchronize
thatstate across multiple processes. NSAPI provides no helper functions for implementing
cross-processsynchronization.
Whenyou specify a MaxProcs value greater than 1, the server relies on the operating system to
distributeconnections among multiple server processes (see “MaxProcs (UNIX/Linux)” on
page45 for information about the MaxProcs directive). However, many modern operating
systemsdo not distribute connections evenly, particularly when there are a small number of
concurrentconnections.
BecauseSun Java System Web Server cannot guarantee that load is distributed evenly among
serverprocesses, you might encounter performance problems if you set Maximum Threads to 1
andMaxProcs greater than 1 to accommodate a legacy application that is not thread-safe. The
problemis especially pronounced if the legacy application takes a long time to respond to
requests(for example, if the legacy application contacts a back-end database). In this scenario, it
mightbe preferable to use the default value for Maximum Threads and serialize access to the
legacyapplication using thread pools. For more information about creating a thread pool, see
“thread-pool-init”in Sun Java System Web Server 7.0 Update 1 Administrator’sConguration
FileReference.
Ifyou are not running any NSAPI in your server, you should use the default settings: one
processand many threads. If you are running an application that is not scalable in a threaded
environment,you should use a few processes and many threads, for example, 4 or 8 processes
and128 or 512 threads per process.
MaxProcs(UNIX/Linux)
Torun a UNIX or Linux server in multi-process mode, set the MaxProcs directive to a value
thatis greater than 1. Multi-process mode might provide higher scalability on multi-processor
machinesand improve the overall server throughput on large systems such as the Sun FireTM
T2000server. If you set the value to less than 1, it is ignored and the default value of 1 is used.
Usethe MaxProcs directive to improve overall server throughput for the following types of
applications:
NSAPIapplications that do not implement ne-grained locking
UnderstandingThreads,Processes, and Connections
Chapter2 • Tuning Sun Java System Web Server 45