美文网首页
乐观锁与主键约束压力测试

乐观锁与主键约束压力测试

作者: 無法定义 | 来源:发表于2018-07-20 15:55 被阅读52次

    乐观锁与主键约束压力测试

    测压环境

    • 18配置:虚拟机,12core,16g内存,docker镜像
    • 19配置:虚拟机,12core,16g内存,docker镜像
    • 数据库版本:5.7.18
    • 主从配置:18上放主库,19上放从库

    数据准备

    • 压测准备:
      • 新建两张表,支付订单表,支付订单状态表
      • 在支付订单表插入700w的数据


        mark
    • 支付订单表:
    /*==============================================================*/
    /* Table: pay_order                                             */
    /*==============================================================*/
    create table pay_order
    (
       pay_order_no         bigint unsigned not null auto_increment comment '支付订单号',
       out_order_no         varchar(32) not null comment '商户订单号',
       app_id               varchar(32) not null comment '平台商户号',
       app_name             varchar(64) not null comment '平台商户名称',
       merchant_id          varchar(32) not null comment '收款商户号',
       merchant_name        varchar(64) not null comment '收款商户名称',
       order_date           char(8) not null comment '订单日期',
       order_time           char(6) not null comment '订单时间',
       order_name           varchar(64) not null comment '订单名称',
       order_amout          int unsigned not null comment '订单金额',
       order_status         tinyint unsigned not null comment '订单状态',
       create_time          datetime not null default CURRENT_TIMESTAMP comment '创建时间',
       primary key (pay_order_no),
       unique key uk_pay_order (out_order_no)
    );
    
    • 支付订单状态表
    /*==============================================================*/
    /* Table: pay_order_state                                       */
    /*==============================================================*/
    create table pay_order_state
    (
       order_no             varchar(32) not null,
       order_state          tinyint unsigned not null,
       create_time          datetime not null default CURRENT_TIMESTAMP,
       primary key (order_no, order_state)
    );
    

    jemter配置

    • 数据源配置:最大连接数150


      mark
    • 线程组配置:并发线程150,循环1000次


      mark

    测试

    • 乐观锁-正常通知处理


      mark
    • 主键约束-正常通知处理


      mark
    • 乐观锁-重复通知处理


      mark
    • 主键约束-重复通知处理


      mark

    测试结果

    测试内容 数据库总吞吐 下单吞吐
    乐观锁-正常通知处理 2608.7/sec 1305.5/sec
    主键约束-正常通知处理 2907.8/sec 969.9/sec
    乐观锁-重复通知处理 4075.5/sec 1358.9/sec
    主键约束-重复通知处理 3638.8/sec 910.5/sec

    相关文章

      网友评论

          本文标题:乐观锁与主键约束压力测试

          本文链接:https://www.haomeiwen.com/subject/vklqmftx.html