系统监控和性能优化

1服务监控:

$shell = "netstat -anp 2>/dev/null | grep ".self::PORT.’ | grep LISTEN | wc -l’;

swoole_timer_tick定时器

发送报警 邮件 短信

2日志处理
d a t a s = a r r a y m e r g e ( [ ′ d a t e ′ = > d a t e ( " Y m d H : i : s " ) ] , datas = array_merge(['date'=>date("Ymd H:i:s")], datas=arraymerge([date=>date("YmdH:i:s")],_GET, P O S T , _POST, POST,_SERVER);
file_put_contents
异步文件处理

3服务平滑重启

swoole_set_process_name(“live_master”);
方案一:
echo “loading…”
pid=pidof live_master
echo $pid
kill -USR1 $pid
echo “loading success”

方案二:
echo “loading…”.PHP_EOL;
$pid = shell_exec(“pidof live_master”);
echo $pid;
s h e l l s = " k i l l − U S R 1 " . shells = "kill -USR1 ". shells="killUSR1".pid;
shell_exec($shells);
echo “loading success”.PHP_EOL;

4nginx安装
下载 解压
./configure --prefix=/home/work/study/soft/nginx --sbin-path=/home/work/study/soft/nginx/sbin/nginx --conf-path=/home/work/study/soft/nginx/config/nginx.conf --error-log
-path=/home/work/study/soft/nginx/logs/error.log --pid-path=/home/work/study/soft/nginx/logs/nginx.pid --http-log-path=/home/work/study/soft/nginx/logs/access.log

make make install

5nignx静态文件支持

修改root 文件路径

6nginx负载均衡

关键;upstream dynamic_zuoyu {
server localhost:8080; #tomcat 7.0
server localhost:8081; #tomcat 8.0
server localhost:8082; #tomcat 8.5
server localhost:8083; #tomcat 9.0
}

关键: proxy_pass http://dynamic_zuoyu;

其他策略

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值