以我的2台云主机都位于杭州区域为例:
https://vpc.console.aliyun.com/vpcpeer/cn-hangzhou/vpcpeers
同地域VPC对等连接不收取任何费用,跨地域VPC对等连接统一由云数据传输CDT(Cloud Data Transfer)收取流量传输费。
专有网络->VPC对等连接->云数据传输CDT(Cloud Data Transfer)->创建对等链接
添加路由条目时,目标网段填写对端的虚拟交换机里的IPv4网段,比如172.31.240.0/20
参考:https://blog.csdn.net/lshy0910/article/details/137038626
$startMemory = memory_get_peak_usage();
//code
$endMemory = memory_get_peak_usage();
$memoryUsage = $endMemory - $startMemory;
$xxx['startMemory'] = $startMemory;
$xxx['endMemory'] = $endMemory;
$xxx['memoryUsage'] = $memoryUsage/1024/1024;
halt($xxx);
nginx+php+mysql这个架构中,出现了VPS偶发性100%CPU资源耗尽,大概持续5分钟又恢复正常,通过检查Mysql慢日志找到了问题:
Time Id Command Argument
# Time: 2024-06-03T11:56:09.101160Z
# User@Host: blog_is36_com[blog_is36_com] @ localhost [] Id: 135566
# Query_time: 8.490175 Lock_time: 0.159524 Rows_sent: 0 Rows_examined: 1386
use blog_is36_com;
SET timestamp=1717415769;
DELETE FROM sablog_sessions WHERE hash='XHm2K9' OR lastactivity<(1717415760-900) OR ('0'<>'0' AND uid='0') OR (uid='0' AND ip1='60' AND ip2='188' AND ip3='9' AND ip4='208' AND lastactivity>1717415760-60) OR (is_robot = '1' AND lastactivity < (1717415760-900));
--------------
# Time: 2024-04-15T10:20:42.123456Z
# User@Host: root[root] @ localhost []
# Query_time: 12.345678 Lock_time: 0.123456 Rows_sent: 456 Rows_examined: 12345
use dbname;
SET timestamp=1234567890;
SELECT * FROM table WHERE non_indexed_column = 'value';
# Time:这是查询执行的时间戳。
# User@Host:执行查询的用户是root,主机是localhost。
# Query_time:查询执行花费了12.345678秒。
# Lock_time:查询在锁定上花费了0.123456秒。
Rows_sent:查询发送了456行数据给客户端。
Rows_examined:查询检查了12345行数据,这可能是性能问题的一个指标,特别是如果检查的行数远大于发送的行数。
use dbname:表明这个查询是在dbname数据库上执行的。
SET timestamp:这是查询执行时的UNIX时间戳。
SELECT:这是实际执行的SQL语句。