IT Technology

mysql 8.0.22有性能回退

测试命令

sysbench --test=oltp_read_write --tables=10 --table-size=1000000 --report-interval=10 --time=3600 --threads=50 --db-driver=mysql --mysql-socket=/tmp/mysql.sock --mysql-user=root --mysql-password='xxxx' --mysql-db=sbtest run

8.0.21 测试结果

SQL statistics:
    queries performed:
        read:                            15339058
        write:                           4382588
        other:                           2191294
        total:                           21912940
    transactions:                        1095647 (304.28 per sec.)
    queries:                             21912940 (6085.57 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          3600.8045s
    total number of events:              1095647

Latency (ms):
         min:                                    2.74
         avg:                                  164.30
         max:                                 5033.06
         95th percentile:                      707.07
         sum:                            180014353.79

Threads fairness:
    events (avg/stddev):           21912.9400/80.08
    execution time (avg/stddev):   3600.2871/0.22

8.0.23 测试结果

SQL statistics:
    queries performed:
        read:                            2969064
        write:                           848304
        other:                           424152
        total:                           4241520
    transactions:                        212076 (58.89 per sec.)
    queries:                             4241520 (1177.79 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          3601.2587s
    total number of events:              212076

Latency (ms):
         min:                                    3.57
         avg:                                  848.89
         max:                                 6098.82
         95th percentile:                     1973.38
         sum:                            180029441.14

Threads fairness:
    events (avg/stddev):           4241.5200/32.35
    execution time (avg/stddev):   3600.5888/0.34

mysql 8.0 关闭binlog

清空日志

mysql> reset master;

查询是否开启了binlog

$mysql -uroot -p
mysql>use mysql;
mysql>
mysql> show variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.01 sec)

阅读全文»

MBP ubuntu从18升级到20启动错误修正

错误信息:

Failed to Set MokListRT: Invalid Parameter
Could not create mokListRT: Invalid Parameter
Importing MOK states has failed: import_mok_state() failed: Invalid Parameter
Continuing boot since secure mode is disabled.

修正:

sudo su -
cd /boot/efi/EFI/ubuntu
cp grubx64.efi shimx64.efi
reboot

参考:(Ubuntu 20.04 Failed to Set MokListRT: Invalid Parameter)[https://askubuntu.com/questions/1279602/ubuntu-20-04-failed-to-set-moklistrt-invalid-parameter]

计算点到直线的距离

2D 中 (C)
参考:https://www.cnblogs.com/yushuo/p/9304218.html

//点PCx,PCy到线段PAx,PAy,PBx,PBy的距离
double GetNearestDistance(double PAx, double PAy,double PBx, double PBy,double PCx, double PCy)
{     
    double a,b,c;  
    a=getDistanceBtwP(PAy,PAx,PBy,PBx);//经纬坐标系中求两点的距离公式
    b=getDistanceBtwP(PBy,PBx,PCy,PCx);//经纬坐标系中求两点的距离公式
    c=getDistanceBtwP(PAy,PAx,PCy,PCx);//经纬坐标系中求两点的距离公式
    if(b*b>=c*c+a*a)return c;   
    if(c*c>=b*b+a*a)return b;  
    double l=(a+b+c)/2;     //周长的一半   
    double s=sqrt(l*(l-a)*(l-b)*(l-c));  //海伦公式求面积 
    return 2*s/a;   
}

3D 中(C#)
参考:https://www.jianshu.com/p/8ba826e6208a

public static float distancePoint2Line(Vector3 point, Vector3 linePoint1, Vector3 linePoint2)
{
    float fProj = Vector3.Dot(point - linePoint1, (linePoint1 - linePoint2).normalized);
    return Mathf.Sqrt((point - linePoint1).sqrMagnitude - fProj * fProj);
}

ubuntu 18.04中netplan配置pre-up和post-down

  1. netplan 自身配置文件/etc/netplan/50-cloud-init.yaml
network:
    version: 2
    renderer: networkd
    ethernets:
        ens3:
            addresses:
            - 154.204.42.134/24
            gateway4: 154.204.42.254
            match:
                macaddress: fa:16:3e:b9:65:3b
            nameservers:
                addresses:
                - 8.8.8.8
                - 8.8.4.4
            set-name: ens3

应用修改

sudo netplan apply

阅读全文»