/**
 * 时长(秒)输出为对应的时分秒
 * @author joyber
 * use:::
 * dom: <i class="duration" data-duration="300"></i>
 * js: $('.duration').durationText({lang:'en', minUnit:'minute'})
 */
!function ($) {
    $.fn.durationText = function (option) {
        var _option = $.extend({
            lang:'zh-cn',
            minUnit: 'second'
        }, option || {})
        this.each(function () {
            var $this = $(this), duration = $this.data('duration')
            var text = [] , lang = {
                    'en': {hour: 'h', minute: "m", second: 's'},
                    'zh-cn': {hour: '时', minute: '分', second: '秒'},
                },
                hourText = lang[_option.lang] && lang[_option.lang]['hour'] || '时',
                minuText = lang[_option.lang] && lang[_option.lang]['minute'] || '分',
                secoText = lang[_option.lang] && lang[_option.lang]['second'] || '秒'
            ;
            if (_option.minUnit == 'minute') duration = Math.ceil(duration / 60) * 60
            else if (_option.minUnit == 'hour') duration = Math.ceil(duration / 3600) * 3600

            if (duration >= 3600) text.push(Math.floor(duration / 3600) + hourText)
            if (duration >= 60) text.push(Math.floor(duration % 3600 / 60) + minuText)
            if (duration % 60 > 0) text.push(duration % 60 + secoText)
            text = text.join('')
            $this.text(text)
        })
    }
}(jQuery);

passthru
(PHP 4, PHP 5, PHP 7, PHP 8)

passthru — 执行外部程序并且显示原始输出

说明
passthru(string $command, int &$return_var = ?): void
同 exec() 函数类似, passthru() 函数 也是用来执行外部命令(command)的。 当所执行的 Unix 命令输出二进制数据, 并且需要直接传送到浏览器的时候, 需要用此函数来替代 exec() 或 system() 函数。 常用来执行诸如 pbmplus 之类的可以直接输出图像流的命令。 通过设置 Content-type 为 image/gif, 然后调用 pbmplus 程序输出 gif 文件, 就可以从 PHP 脚本中直接输出图像到浏览器。

proc_open
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

proc_open — 执行一个命令,并且打开用来输入/输出的文件指针。

说明
proc_open(

mixed $cmd,
array $descriptorspec,
array &$pipes,
string $cwd = null,
array $env = null,
array $other_options = null

): resource
类似 popen() 函数, 但是 proc_open() 提供了更加强大的控制程序执行的能力。

symlink
(PHP 4, PHP 5, PHP 7, PHP 8)

symlink — 建立符号连接

说明
symlink(string $target, string $link): bool
symlink() 对于已有的 target 建立一个名为 link 的符号连接。

putenv
(PHP 4, PHP 5, PHP 7, PHP 8)

putenv — 设置环境变量的值

说明
putenv(string $setting): bool
添加 setting 到服务器环境变量。 环境变量仅存活于当前请求期间。 在请求结束时环境会恢复到初始状态。

mysqlslap是mysql自带的基准测试工具,优点:查询数据,语法简单,灵活容易使用.该工具可以模拟多个客户端同时并发的向服务器发出查询更新,给出了性能测试数据而且提供了多种引擎的性能比较.
常用的选项
--concurrency    并发数量,多个可以用逗号隔开
--engines       要测试的引擎,可以有多个,用分隔符隔开,如--engines=myisam,innodb
--iterations      要运行这些测试多少次
--auto-generate-sql        用系统自己生成的SQL脚本来测试
--auto-generate-sql-load-type   要测试的是读还是写还是两者混合的(read,write,update,mixed)
--number-of-queries        总共要运行多少次查询。每个客户运行的查询数量可以用查询总数/并发数来计算
--debug-info            额外输出CPU以及内存的相关信息
--number-int-cols          创建测试表的int型字段数量
--number-char-cols       创建测试表的chat型字段数量
--create-schema          测试的database
--query 自己的SQL         脚本执行测试
--only-print            如果只想打印看看SQL语句是什么,可以用这个选项

实例1
说明:测试100个并发线程,测试次数1次,自动生成SQL测试脚本,读、写、更新混合测试,自增长字段,测试引擎为innodb,共运行5000次查询

#mysqlslap -h127.0.0.1 -uroot -p123456789 --concurrency=100 --iterations=1 --auto-generate-sql --auto-generate-sql-load-type=mixed --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=5000
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.351 seconds      100个客户端(并发)同时运行这些SQL语句平均要花0.351秒
Minimum number of seconds to run all queries: 0.351 seconds
Maximum number of seconds to run all queries: 0.351 seconds
Number of clients running queries: 100               总共100个客户端(并发)运行这些sql查询
Average number of queries per client:50             每个客户端(并发)平均运行50次查询(对应--concurrency=100,--number-of-queries=5000;5000/100=50)

实例2

#mysqlslap -h127.0.0.1 -uroot -p123456789 --concurrency=100,500,1000 --iterations=1 --auto-generate-sql --auto-generate-sql-load-type=mixed --auto-generate-sql-add-autoincrement --engine=innodb --number-of-queries=5000 --debug-info
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.328 seconds
Minimum number of seconds to run all queries: 0.328 seconds
Maximum number of seconds to run all queries: 0.328 seconds
Number of clients running queries: 100
Average number of queries per client: 50

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.358 seconds
Minimum number of seconds to run all queries: 0.358 seconds
Maximum number of seconds to run all queries: 0.358 seconds
Number of clients running queries: 500
Average number of queries per client: 10

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.482 seconds
Minimum number of seconds to run all queries: 0.482 seconds
Maximum number of seconds to run all queries: 0.482 seconds
Number of clients running queries: 1000
Average number of queries per client: 5


User time 0.21, System time 0.78
Maximum resident set size 21520, Integral resident set size 0
Non-physical pagefaults 12332, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 36771, Involuntary context switches 1396

实例3(自定义sql语句)

#mysqlslap -h127.0.0.1 -uroot -p123456789 --concurrency=100 --iterations=1 --create-schema=rudao --query='select * from serverlist;' --engine=innodb --number-of-queries=5000 --debug-info
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.144 seconds
Minimum number of seconds to run all queries: 0.144 seconds
Maximum number of seconds to run all queries: 0.144 seconds
Number of clients running queries: 100
Average number of queries per client: 50


User time 0.05, System time 0.09
Maximum resident set size 6132, Integral resident set size 0
Non-physical pagefaults 2078, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 6051, Involuntary context switches 90

实例4(指定sql脚本)

#mysqlslap -h127.0.0.1 -uroot -p123456789 --concurrency=100 --iterations=1 --create-schema=rudao --query=/tmp/query.sql --engine=innodb --number-of-queries=5000 --debug-info
Warning: Using a password on the command line interface can be insecure.
Benchmark
Running for engine innodb
Average number of seconds to run all queries: 0.157 seconds
Minimum number of seconds to run all queries: 0.157 seconds
Maximum number of seconds to run all queries: 0.157 seconds
Number of clients running queries: 100
Average number of queries per client: 50


User time 0.07, System time 0.08
Maximum resident set size 6152, Integral resident set size 0
Non-physical pagefaults 2107, Physical pagefaults 0, Swaps 0
Blocks in 0 out 0, Messages in 0 out 0, Signals 0
Voluntary context switches 6076, Involuntary context switches 89

===================php74-fpm/ cat Dockerfile:
FROM php:7.4-fpm
WORKDIR "/www/wwwroot/"

# make sure apt is up to date
RUN apt-get update --fix-missing \
    && apt-get install -y curl build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 9.2.0

ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd && docker-php-ext-install pdo pdo_mysql mysqli bcmath

====================build php:fpm74
docker build -t php:fpm74 .

--Successfully built 46769bebb626
--Successfully tagged php:fpm74


====================docker create container nginx and php
docker run -d --name demo-nginx -p 8080:80 \
-v /www/wwwroot/:/www/wwwroot/ -v /etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf \
nginx

docker run -d --name demo-php74 -p 9000:9000 \
-v /www/wwwroot/:/www/wwwroot/ \
php:fpm74

安装win11后Docker运行报错,主要报错内容是Microsoft .NET Framework无法连接xxx,其实就是无法连接到wsl2。
根据Docker官方说明,需要升级到最新的wsl2内核和Docker Desktop。

安装wsl

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

更新wsl

wsl --update
wsl --shutdown

安装最新版的Docker Desktop:www.docker.com下载

亲测还是没有成功,问题待解决