mysql运行测速_多线程数据库插入速度测试

/**

*

*

* 每个进程都单独连接数据库

* */

//configruation parameters

$tbl_id = 0;

$count_per_process = 10;

$concurrents = 100;

$logpath = "/tmp/s.log";

$host = "10.218.26.75";

$user = "user";

$pwd = "pwd";

$db = "test";

$port = 3306;

$sep = 1000;

$uid_count = 100000;

$uid_path= 100000;

if ($argc != 13) {

echo "Usage:php multiprocess.php tbl_id concurrents count_per_process logpath host user pwd db port sep_counts uid_count uid_path\n";

echo "Usage:php multiprocess.php 表ID 并发数 每进程多少次 记录路径 主机 用户 密码 数据库 端口 多少条记录一次 用户数 用户UID保存路径\n";

exit(1);

} else {

$tbl_id= trim($argv[1]);

$concurrents = (int)trim($argv[2]);

$count_per_process= (int)trim($argv[3]);

$logpath = trim($argv[4]);

$host = trim($argv[5]);

$user = trim($argv[6]);

$pwd = trim($argv[7]);

$db = trim($argv[8]);

$port = trim($argv[9]);

$sep = trim($argv[10]);

$uid_count= (int)trim($argv[11]);

$uid_path = trim($argv[12]);

if($uid_count < $concurrents and ($uid_count % $concurrents !=0 )) {

die("UID数必须多过并发进程数并曲uid数必须是进程数的整数倍\n");

}

$uid_count = $uid_count / $concurrents;

}

$shm_key = ftok(__FILE__, 't');

$shm_id = shmop_open($shm_key, "c", 0644, 100);

shmop_write($shm_id, 0, 0);

$m_start= microtime(true);

$conf = array(

'count' => $count_per_process,

'host' => $host,

'user' &#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值