Paozhu logoPaozhu Docs
Documentation
OPS

Deployment & performance

Release build, daemon mode, systemd, Nginx proxy, benchmarks and troubleshooting.

Build and start

terminalbash
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
cd ..
# set deamon_enable = 1 in conf/server.conf for production
./bin/paozhu conf/server.conf

curl -I http://127.0.0.1/hello
ab -n 100000 -c 100 http://127.0.0.1/plaintext
h2load -n 10000 -c 100 -m 10 https://www.example.com/

systemd unit

/etc/systemd/system/paozhu.serviceini
[Unit]
Description=Paozhu Web Framework
After=network.target

[Service]
Type=forking
WorkingDirectory=/opt/paozhu
ExecStart=/opt/paozhu/bin/paozhu /opt/paozhu/conf/server.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

With deamon_enable = 1 the process forks to the background. The production entry main_daemon.cpp uses a supervisor/worker layout and forks a new worker after a crash.

Reverse proxy

Nginx can terminate HTTPS and proxy to paozhu’s httpport. WebSocket proxying must forward Upgrade and Connection. Keep httpport aligned with the proxy_pass port.

Benchmarks

Use ab for HTTP/1.1, h2load for HTTP/2 and h2spec for protocol conformance. Benchmark routes live in controller/src/techempower.cpp.

Troubleshooting

SymptomCheck
Route 404Check whether common/autocontrolmethod.hpp contains the route.
DB connection failsCheck tag, credentials and dbtype in conf/orm.conf.
Static 404Check wwwpath and file permissions.
Startup failurePass ./bin/paozhu conf/server.conf explicitly and inspect log/.