2 Star 1 Fork 0

licslan / Test100

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Getting Started

Reference Documentation

Do test for Multithreading and Single thread:

Guides

The following guides illustrate how to use some features concretely:

Test result blow

  • we use 1000 as init data and insert those data to MySQL

  • we use 5000 as second time and insert those data to MySQL

  • we use 50000 as Third time and insert those data to MySQL

  • we use 500000 as fourth time and insert those data to MySQL

  • we use 1000000 as fifth time and insert those data to MySQL

    • 实验结果 MySQL < 1c 2g
    • 相同条件下面 重启服务 写入数据 重建表 再写入数据对比
    • 1000条 首次 测试1000写入
    • 实验结果如下:
    • 单线程:
    • 写入1000条
    • 单线程统计用时:1746 毫秒
    • 多线程:
    • 每次写入数据库多少[ 1000 ]条
    • 多线程统计用时:1136 毫秒
    • ====================================
    • 5000条 第二次 测试5000写入
    • 单线程:
    • 写入5000条
    • 单线程统计用时:1344 毫秒
    • 多线程:
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 多线程统计用时:1809 毫秒
    • ====================================
    • 50000条 第三次 测试5万写入
    • 单线程:
    • 写入50000条
    • 单线程统计用时:2857 毫秒
    • 多线程:
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 多线程统计用时:2360 毫秒
    • 上面已经有了约500毫秒差距 多线程快 500毫秒
    • ====================================
    • 500000条 第四次 测试50万条数据写入
    • 单线程:
    • 写入500000条
    • 单线程统计用时:23786 毫秒 约 24秒钟
    • 多线程:
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 多线程统计用时:9021 毫秒 约 9 秒 比上面的24秒快15秒了 !!!
    • 其实可以尝试提高每次写入的数据batchSize 当前2500 但是 mybatis批量写入一次好像是有限制的 忘记了多少 可以查一下
    • 下面调整为batchSize = 10000
    • 每次写入数据库多少[ 10000 ]条
    • 每次写入数据库多少[ 10000 ]条
    • 多线程统计用时:9425 毫秒
    • 下面调整为batchSize = 5000
    • 每次写入数据库多少[ 5000 ]条
    • 每次写入数据库多少[ 5000 ]条
    • 多线程统计用时:9620 毫秒
    • 对比发现 2500 5000 10000 时 时间差不多了
    • ====================================
    • 1000000条 第五次 测试100万条数据写入 此时batchSize恢复为 2500
    • 单线程:
    • 写入1000000条
    • 单线程统计用时:44271 毫秒 约44秒
    • 多线程:
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 每次写入数据库多少[ 2500 ]条
    • 多线程统计用时:15062 毫秒 约 15秒

How we start?

  • Install JDK8+ Maven3.2+
  • Follow the spring.io to build a spring boot project
  • Add dependence file in pom.xml file
  • Connect to MySQL first and then read and wirte data to database
  • Then write code about thread pool

Test100

介绍

测试多线程(线程池)与单线程写数据到MySQL效率对比

软件架构

软件架构说明

安装教程

  1. xxxx
  2. xxxx
  3. xxxx

使用说明

  1. xxxx
  2. xxxx
  3. xxxx

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

空文件

简介

测试多线程(线程池)与单线程写数据到MySQL效率对比 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/licslan/Test100.git
git@gitee.com:licslan/Test100.git
licslan
Test100
Test100
master

搜索帮助