WebtoB Process Structure
To ensure stable service, WebtoB automatically restarts processes when they terminate abnormally. By default, the Manager and Engine processes are started together.
Process Types
The following describes each process type of WebtoB.
| Process | Description |
|---|---|
Restarts the abnormally terminated Engine process. |
|
Handles HTTP requests. |
|
The settings for the Manager and Engine must be identical. If the settings of a running process differs from the new settings, you can choose whether to restart the process with the modified settings. |
Manager Process
The Manager process manages the web server process (Engine) that handles HTTP requests. It monitors the Engine process and automatically restarts it if it terminates abnormally. If an Engine process is already running, the Manager process manages it.
Only one Manager process can run at a time. By default, WebtoB starts the Manager and Engine together, but the Manager can be started independently using the following command if necessary.
> webtob -a start-manager
In addition, WebtoB provides an Admin API via a Rest API. The Manager port is configured in the NODE section, and main APIs are as follows:
| API | Description |
|---|---|
Views the configuration settings. |
|
Shuts down the WebtoB Manager. |
Retrieving Configuration (/config)
Retrieves the configuration information of the currently running system. This includes not only the values specified in the configuration file, but also default values.
-
Usage
{ "path": string }Option Description path
Specifies the JSON path of the configuration file. This path must always start with a slash (/).
If the path is omitted or set to '/', all currently configuration settings are retrieved. -
Example
The following is an example of retrieving the NODE section configuration using "/config" Admin API. For more information about configuration items of the NODE section, refer to Configuration Items.
[Request] { "path": "/node" } [Response] { "result": { "cache_entry": 128, "cache_key": "HOST_URI", "cache_max_file_size": 8192, "connection_pool_size": 8192, "graceful_shutdown_timeout": 5, "hth_count": 1, "hth_schedule": "RR", "limit_request_body_size": 0, "limit_request_header_field_count": 100, "limit_request_header_field_size": 8190, "limit_request_line_size": 8190, "listen_backlog": 4096, "max_cache_memory_size": 100, "name": "webtob-server", "system_filters": [], "worker_threads": 1 } }
Shutting Down WebtoB Manager (/shutdownmanager)
Shuts down the running WebtoB Manager.
-
Usage
{ "timeout": integer }Option Description timeout
Specifies the graceful shutdown timeout in seconds. If the WebtoB Manager does not shut down within the specified time, it is forcibly terminated.
If omitted, the value set in /node/graceful_shutdown_timeout will be applied. -
Example
The following is an example of calling the "/shutdownmanager" Admin API to forcibly terminate the WebtoB Manager if it does not shut down after a 30-second graceful shutdown attempt.
[Request] { "timeout": 30 } [Response] { "result": {} }The response is returned immediately after WebtoB receives the command. However, the WebtoB Manager process may still be running even after the response is returned. Even if the WebtoB Manager is shut down, the Engine process is not terminated.
Engine Process
The Engine process handles HTTP requests. Each process has an index, starting from 0. The number of processes to run can be configured using /node/process_count.
|
Even while WebtoB is running, the number of Engine processes can be adjusted by modifying the |
By default, WebtoB starts the Manager and Engine together. However, if necessary, the Engine can be started independently using the following command.
> webtob -a start-engine
In addition, WebtoB provides an Admin API via a Rest API. For more information, refer to WebtoB Admin API.
|
Specifying |
Process Privileges and Privileged Ports
Privileged Ports and WebtoB Execution Permissions
Web servers typically use port 80 for HTTP and port 443 for HTTPS. These are classified as privileged ports (1-1023) by the operating system and can only be used by processes with root privileges.
Therefore, WebtoB must be run with root privileges to use these ports, and the environment variables must also be configured with root privileges.
The following example shows how to start WebtoB with root privileges to use privileged ports.
> sudo -E WEBTOB_HOME=/home/webtob/ ./webtob
Issues When Running as Root
When the WebtoB binary is executed with root privileges, both the Manager process and the Engine process are started with root privileges.
However, because the Engine process directly handles external HTTP requests, running it with root privileges increases security risks.
The following shows the process privileges when WebtoB binary is executed with root privileges.
> ps -eo pid,user,comm | grep WebtoB 396052 root WebtoB Manager 396053 root WebtoB Engine-0 396054 root WebtoB Engine-1 396055 root WebtoB Engine-2
Engine Privilege Separation
Using the /node/user setting, WebtoB can run the Engine process as a regular user. The specified user must have lower privileges than the user used to execute the WebtoB binary.
"node": {
"user": "webtob"
}
After starting WebtoB with root privileges and specifying a regular user in /node/user, it behaves as follows:
-
The Manager process runs with root privileges.
-
The Engine process runs with the user privileges specified in
/node/user.
This architecture enhances security by allowing the Manager to open privileged ports (1-1023) while the Engine operates with lower privileges.
The following shows the process privileges when the WebtoB binary is started with root privileges while /node/user is set to 'webtob'.
> ps -eo pid,user,comm | grep WebtoB 396052 root WebtoB Manager 396053 webtob WebtoB Engine-0 396054 webtob WebtoB Engine-1 396055 webtob WebtoB Engine-2
|
If the |