HelpChat Server performance tuning

How the server handles high concurrency, how to adjust the worker count, and how to enable TCP Fast Open.

1. How high concurrency works

The server installation root contains four core files:

ProcessRoleArchitecture
hcdataData server (transfers large data such as files, cloud drive content and images)Multi-process
hckernelCore message server (sends and receives messages, maintains online status)Multi-threaded
hcloginLogin server (login and registration)Multi-process
hcadminWeb admin console (not performance related)—

Multi-process architecture: runs a set number of copies of the same process, which share the high-concurrency workload. Multi-threaded architecture: runs a set number of worker threads in one process, which handle all high-concurrency tasks.

The three performance-related processes use 8 workers by default. This may not be enough on a high-performance server. Use the -worker parameter to see the recommended value:

bash
./hckernel -worker

For example, an i9 CPU with 16 logical processors has a recommended worker count of 8 to 16.

Changing the worker count

Open config/server.ini in the server installation directory, change the following numbers and save:

config/server.ini
[worker]
hclogin  = 8
hckernel = 8
hcdata   = 8

Choose values based on the number of CPU cores, memory size, number of online users and how often large files are transferred. Restart all background services after the change.

3. Enabling TCP Fast Open on Linux servers

Enabling TCP Fast Open on Linux can make network connections 10% to 25% faster, so images display and files download sooner:

bash
echo 3 > /proc/sys/net/ipv4/tcp_fastopen

To make it permanent, edit /etc/sysctl.conf and add:

ini
net.ipv4.tcp_fastopen = 3

Tip

After editing sysctl.conf, run sysctl -p to apply it immediately without a restart.