Eljay

Photo by Austin Distel on Unsplash

This is only a basic chat application using Swoole. I’ll try to make it simple as possible so that anyone could easily grasp, but for the framework, I used a little bit of Yii2 here.

MySQL Client

Websocket Server

NGINX (Reverse Proxy for Websocket and MySQL)

Kernel Configuration

sysctl -w fs.file-max=12000500
sysctl -w fs.nr_open=20000500
ulimit -n 4000000
sysctl -w net.ipv4.tcp_mem=’10000000 10000000 10000000'
sysctl -w net.ipv4.tcp_rmem=’1024 4096 16384'
sysctl -w net.ipv4.tcp_wmem=’1024 4096 16384'
sysctl -w net.core.rmem_max=16384
sysctl -w net.core.wmem_max=16384
sysctl -w net.ipv4.tcp_tw_reuse = 1
sysctl -w net.ipv4.tcp_tw_recycle = 1
sysctl -w net.ipv4.ip_local_port_range = 1024 65000
echo “root soft nofile 4000000” >> /etc/security/limits.conf
echo “root hard nofile 4000000” >> /etc/security/limits.conf
echo 2621440 > /proc/sys/net/netfilter/nf_conntrack_max

Supervisor Configuration

Note that I used supervisor instead of systemd for these two services.

That’s it! :)

[DRAFT MODE]

--

--