layui-vue
llayui – vue(谐音:类 UI) 是 一 套 Vue 3.0 的 桌 面 端 组 件 库 , Layui 的 另 一 种 呈 现 方 式。
llayui – vue(谐音:类 UI) 是 一 套 Vue 3.0 的 桌 面 端 组 件 库 , Layui 的 另 一 种 呈 现 方 式。
composer PHP Fatal error: Allowed memory size of XXXXXXXXXXX bytes exhausted
在 composer install 中遇到类似的错误,这是一个与内存相关的错误。
解决方法:
php -d memory_limit=-1 /usr/local/bin/composer install
这将允许您仅在运行此命令时禁用内存限制。
如果你觉得每次都输入上面的命令很烦,建议在登录用户的~/.bashrc 等处写上别名。
alias composer=’php -d memory_limit=-1 /usr/local/bin/composer’
一、ab(Apache Bench) 压测
ApacheBench 是 Apache服务器自带的一个web压力测试工具,简称ab。ab又是一个命令行工具,对发起负载的本机要求很低,根据ab命令可以创建很多的并发访问线程,模拟多个访问者同时对某一URL地址进行访问,因此可以用来测试目标服务器的负载压力。总的来说ab工具小巧简单,上手学习较快,可以提供需要的基本性能指标,但是没有图形化结果,不能监控。
语法及参数
Usage: ab [options] [http[s]://]hostname[:port]/path
用法:ab [选项] 地址
选项:
-n requests #执行的请求数,即一共发起多少请求。
-c concurrency #请求并发数。
示例:
ab -c 5 -n a https://www.baidu.com
二、go-stress-testing
go 实现的压测工具,每个用户用一个协程的方式模拟,最大限度的利用 CPU 资源
clone 项目
git clone https://github.com/link1st/go-stress-testing.git
cd go-stress-testing
go run main.go -c 5 -n 1 -u https://www.baidu.com
参数说明:
-c 表示并发数
-n 每个并发执行请求的次数,总请求的次数 = 并发数 * 每个并发执行请求的次数
-u 需要压测的地址
Go语言编译失败,输出如下错误日志,关键错误提示 invalid pseudo-version
go: XXXXXXX: invalid pseudo-version: git fetch –unshallow -f origin in XXXXXXXXXX: exit status 128:
fatal: git fetch-pack: expected shallow list
fatal: The remote end hung up unexpectedly
报错原因是Git客户端版本太旧了.
https://github.com/golang/go/issues/38373
在 CentOS 7 和 RHEL 7 上,如果使用默认存储库进行安装,则版本为 1.8.3.1。
解决方法:
升级GIT,对于 CentOS 7 和 RHEL 7,使用 IUS 存储库安装将解决问题。
$ yum -y erase git
$ yum -y install https://repo.ius.io/ius-release-el7.rpm
$ yum -y install git222
检查版本:
$ git –version
git version 2.22.5
适用于有高精度需求的场景
导入:decimal模块
from decimal import Decimal
class DecimalEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, Decimal):
return str(obj)
return json.JSONEncoder.default(self, obj)
val = Decimal(1)/Decimal(3)
number = val.quantize(Decimal("0.00000000")) #0.33333333
result = {'data': Decimal(number)}
return json.dumps(result, cls=DecimalEncoder)