A LightWave Server (LWS) instance consists of the SERVER process pair and zero (yes zero) or more SWORKER processes. The SERVER process receives all new client connection requests and delegates them to available SWORKER processes using a least connection algorithm. The SWORKER process then processes the connection, transforming between JSON and IPM, and forwarding requests to application processes or serverclasses. If no SWORKER processes are running, the SERVER process processes the connection just like an SWORKER process would. The SERVER process also acts as the application server for the LightWave Server Console.
Determining the number of SWORKER processes to run in a LWS instance depends entirely on the requirements of the application. Every application has different payload sizes and each payload has a different number of fields and field types, both affecting payload de/serialization times. And each application has unique throughput (TPS) and response time requirements. Determining the number of SWORKER processes in a production application is similar to balancing a Pathway application. If the application isn't responding as required, add more SWORKERS, spread them across CPUs, and re-assess.
Note that the SERVER process is fault tolerant and runs as a process pair. SWORKER processes are standalone processes but are persistent. If an SWORKER process fails, its associated SERVER process will immediately restart it.
The following best practices can be used as a guide for determining the best SWORKER process configuration:
- In a development environment, it is often best to create an isolated LWS instance for each developer. In this case, it's not necessary to run any SWORKER processes.
- For production environments and their QA/cert environments, start with two SWORKER processes running in CPUs other than the SERVER processes. For example, if SERVER is running in CPU 0/1, run SWORKERs in CPUs 2 & 3.
- If application response is not sufficient, begin scaling out by adding SWORKERs across CPUs.
- Note that LWS response times are governed by the response times of the underlying Pathway or standalone process application. If response time is not sufficient after adding additional SWORKER processes, use LWS MEASURE counters to determine whether the bottleneck exists in LWS or the application. For more information see Using MEASURE Counters.