https://www.zabbix.com/download?zabbix=3.4&os_distribution=centos&os_version=7&db=MySQL
月度归档:2018年07月
MQ选型对比RabbitMQ RocketMQ ActiveMQ
GuzzleHttp 400 500 时获取内容的方法
http_errors
- Summary
- Set to
false
to disable throwing exceptions on an HTTP protocol errors (i.e., 4xx and 5xx responses). Exceptions are thrown by default when HTTP protocol errors are encountered. - Types
- bool
- Default
true
- Constant
GuzzleHttp\RequestOptions::HTTP_ERRORS
$client->request('GET', '/status/500');
// Throws a GuzzleHttp\Exception\ServerException
$res = $client->request('GET', '/status/500', ['http_errors' => false]);
echo $res->getStatusCode();
// 500
Mongodb性能调优 -性能优化建议
https://blog.csdn.net/happy_jijiawei/article/details/53737858
phpstorm 代码提示不区分大小写,自动导入命名空间
默认效果:
zend studio 效果
手动效果:
phpstorm配置自动导入方法:
phpstorm代码提示不区分大小写配置
beanstalkd 安装和配置
安装
安装以centos为例
yum install beanstalkd
配置
使用centos yum安装,通过查看服务脚本发现有这个配置文件
cat /etc/sysconfig/beanstalkd
主要修改几个地方
ADDR=-l 10.1.3.16 # 修改为内网或本地地址,否则会开放外网非常危险
PORT=-p 11111 # 修改下端口
BINLOG_DIR=-b /var/lib/beanstalkd/binlog # 启用二进制日志防止意外断电或重启导致数据丢失
客户端连接问题:
Connection error 113: No route to host
解决办法:防火墙开放对应端口
性能:
$start = microtime(true); for ($i = 0; $i < 100000; $i ++) { $beansClient->useTube('myAwesomeTube')->put("哈哈哈job's payload呵呵呵呵"); } echo microtime(true) - $start, "\n";
插入一万条数据一秒(本地连接)
插入十万条数据十秒(本地连接)
插入一万条数据14秒(内网连接)
本地取出1w条数据要1.5秒
内网取出1w条数据要33秒
本地取出 1173359条数据 要 200秒
结论:吃内存,快还是慢你觉得呢?
php-fpm优化参数合集
nginx 优化参数合集
RabbitMQ 简单队列
我想要的是定时任务延时队列,似乎不满足需求,现在用redis做的队列又可以满足大部分需求,先放着吧
# 推送到队列 public function aa032() { $connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest'); $channel = $connection->channel(); $channel->queue_declare('hello', false, false, false, false); $msg = new AMQPMessage('Hello World 233!'); $channel->basic_publish($msg, '', 'hello'); echo " [x] Sent 'Hello World 233!'\n"; $channel->close(); $connection->close(); } # 守护处理队列 public function aa033() { $connection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest'); $channel = $connection->channel(); $channel->queue_declare('hello', false, false, false, false); echo " [*] Waiting for messages. To exit press CTRL+C\n"; $callback = function ($msg) { echo ' [x] Received ', $msg->body, "\n"; }; $channel->basic_consume('hello', '', false, true, false, false, $callback); while (count($channel->callbacks)) { $channel->wait(); } }