heikki@hundin:~/test> cat ibtest3 ############################################################################ # Stress test for MySQL/Innobase combined database # (c) 2000 Innobase Oy & MySQL AB # ############################################################################ use DBI; use Benchmark; $opt_loop_count = 1000; $opt_loop_count2 = 50; chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; print "Generating random keys\n"; $random[$opt_loop_count] = 0; $rnd_str[$opt_loop_count] = "a"; for ($i = 0; $i < $opt_loop_count; $i++) { $random[$i] = ($i * 63857) % $opt_loop_count; if ($i < 10) { if (0 == ($random[$i] % 3)) { $rnd_str[$i] = "kjgclgrtfuylfluyfyufyulfulfyyulofuyolfyufyufuyfy ufyufyufyufyyufujhfghd"; } else { if (1 == ($random[$i] % 3)) { $rnd_str[$i] = "khd"; } else { if (2 == ($random[$i] % 3)) { $rnd_str[$i] = "kh"; }}} for ($j = 0; $j < (($i * 764877) % 50000); $j++) { $rnd_str[$i] = $rnd_str[$i]."k"; } } } #### #### Connect #### print length($rnd_str[5])."\n"; print length($rnd_str[6])."\n"; print length($rnd_str[7])."\n"; $dbh = $server->connect(); $dbh->do("set autocommit = 1"); $dbh->do("drop table blobt3"); $dbh->do( "create table blobt3 (A INT NOT NULL, D INT NOT NULL, B BLOB NOT NULL, C TEXT, PRIMARY KEY (B(10), A, D), INDEX (D), INDEX(A), INDEX (C(255), B(255)), I NDEX (B(5), C(10), A)) TYPE = INNODB"); $dbh->{LongReadLen}= 1000000; # Set retrieval buffer for ($i = 0; $i < 1; $i++) { $k = 0; print "loop $i\n"; for ($t = 0; $t < 100; $t++) { for ($j = 1; $j < $opt_loop_count - 10; $j = $j + 1) { if ($dbh->do( "insert into blobt3 values (".$random[$j].", 5,'".$rnd_str[($j % 10)]."' ,'".$rnd_str[($j % 10)]."')")) { $sth = $dbh->prepare("select * from blobt3 where a = ".$random[$ j]) or die "Cannot prepare\n"; if (!$sth->execute || !(@row = $sth->fetchrow_array)) { print "$DBI::errstr - ".length($row[2])."ins select **\n "; } if ($row[2] != $rnd_str[($j % 10)]) { print "Error in insert of B\n"; } if (length($row[2]) != length($rnd_str[($j % 10)])) { print "Error in insert of B\n"; } if ($row[3] != $rnd_str[($j % 10)]) { print "Error in insert of C\n"; } $sth->finish; } else { print $dbh->errstr; } $dbh->do( "insert into blobt3 values (".$random[$j].", 6,'".$rnd_str[($j % 10)]."' ,'".$rnd_str[($j % 10)]."')"); if ($dbh->do("update blobt3 set B = '".$rnd_str[($j + 1) % 10]." ' where A =".$random[$j])) { $sth = $dbh->prepare("select * from blobt3 where a = ".$random[$ j]); if (!$sth->execute || !(@row = $sth->fetchrow_array)) { print "$DBI::errstr - ".length($row[2])." err upd **\n"; } if ($row[2] != $rnd_str[(($j + 1) % 10)]) { print "Error in update of B\n"; } $sth->finish; } else { print $dbh->errstr; } $s = fetch_all_rows($dbh, "select tab1.a, tab1.b, tab1.c, tab1.d , tab2.a, tab2.b, tab2.c, tab2.d from blobt3 tab1 LEFT JOIN blobt3 tab2 ON tab1. a = tab2.a where tab1.a = ".$random[$j]." group by tab1.a order by tab2.c desc l imit 0, 3" ); $s = fetch_all_rows($dbh, "select * from blobt3 where b like 'kh dkkk%'"); $s = fetch_all_rows($dbh, "select * from blobt3 where c like 'kh dkkk%'"); $s = fetch_all_rows($dbh, "select * from blobt3 where b like 'kh dkkkkkkkkkkkkkkkkkkkkkkkk%'"); $s = fetch_all_rows($dbh, "select * from blobt3 where c like 'kh d%'"); $dbh->do("delete from blobt3 where A = ".$random[$random[$j]]) or print $dbh->errstr; if (0 == ($j % 21)) { print "rollback $j\n"; $dbh->do("rollback") or print $dbh->errstr; } if (0 == ($j % 5)) { print "commit $j\n"; $dbh->do("commit") or print $dbh->errstr; } if (0 == ($j % 171)) { $dbh->do("check table blobt3"); } if (0 == ($j % 100)) { $s = fetch_all_rows($dbh, "select * from blobt3"); } } } $dbh->do("commit"); } $dbh->disconnect; # close connection heikki@hundin:~/test> cat ibtest3a ############################################################################ # Stress test for MySQL/Innobase combined database # (c) 2000 Innobase Oy & MySQL AB # ############################################################################ use DBI; use Benchmark; $opt_loop_count = 1000; $opt_loop_count2 = 50; chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; print "Generating random keys\n"; $random[$opt_loop_count] = 0; $rnd_str[$opt_loop_count] = "a"; for ($i = 0; $i < $opt_loop_count; $i++) { $random[$i] = ($i * 63857) % $opt_loop_count; if ($i < 10) { if (0 == ($random[$i] % 3)) { $rnd_str[$i] = "kjgclgrtfuylfluyfyufyulfulfyyulofuyolfyufyufuyfy ufyufyufyufyyufujhfghd"; } else { if (1 == ($random[$i] % 3)) { $rnd_str[$i] = "khd"; } else { if (2 == ($random[$i] % 3)) { $rnd_str[$i] = "kh"; }}} for ($j = 0; $j < (($i * 764877) % 51000); $j++) { $rnd_str[$i] = $rnd_str[$i]."k"; } } } #### #### Connect #### print length($rnd_str[5])."\n"; print length($rnd_str[6])."\n"; print length($rnd_str[7])."\n"; $dbh = $server->connect(); $dbh->do("set autocommit = 0"); $dbh->{LongReadLen}= 1000000; # Set retrieval buffer for ($i = 0; $i < 1; $i++) { $k = 0; print "loop $i\n"; for ($t = 0; $t < 100; $t++) { for ($j = 1; $j < $opt_loop_count - 10; $j = $j + 1) { if ($dbh->do( "insert into blobt3 values (".$random[$j].", 5,'".$rnd_str[($j % 10)]."' ,'".$rnd_str[($j % 10)]."')")) { $sth = $dbh->prepare("select * from blobt3 where a = ".$random[$ j]) or die "Cannot prepare\n"; if (!$sth->execute || !(@row = $sth->fetchrow_array)) { print "$DBI::errstr - ".length($row[2])."ins select **\n "; } if ($row[2] != $rnd_str[($j % 10)]) { print "Error in insert of B\n"; } if (length($row[2]) != length($rnd_str[($j % 10)])) { print "Error in insert of B\n"; } if ($row[3] != $rnd_str[($j % 10)]) { print "Error in insert of C\n"; } $sth->finish; } else { print $dbh->errstr; } if ($dbh->do("update blobt3 set B = '".$rnd_str[($j + 1) % 10]." ' where A =".$random[$j])) { $sth = $dbh->prepare("select * from blobt3 where a = ".$random[$ j]); if (!$sth->execute || !(@row = $sth->fetchrow_array)) { print "$DBI::errstr - ".length($row[2])." err upd **\n"; } if ($row[2] != $rnd_str[(($j + 1) % 10)]) { print "Error in update of B\n"; } $sth->finish; } else { print $dbh->errstr; } $dbh->do("delete from blobt3 where A = ".$random[$random[$j]]) or print $dbh->errstr; if (0 == ($j % 19)) { # $dbh->do("check table blobt3"); # fetch_all_rows($dbh, "select b, c from blobt3 where a >= ".$random[$j]." and a < ".($random[$j] + 100)); print "rollback $j\n"; $dbh->do("rollback") or print $dbh->errstr; } if (0 == ($j % 5)) { print "commit $j\n"; $dbh->do("commit") or print $dbh->errstr; } } } $dbh->do("commit"); } $dbh->disconnect; # close connection heikki@hundin:~/test> cat ibtest3b ############################################################################ # Stress test for MySQL/Innobase combined database # (c) 2000 Innobase Oy & MySQL AB # ############################################################################ use DBI; use Benchmark; $opt_loop_count = 1000; $opt_loop_count2 = 50; chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; #### #### Connect #### $dbh = $server->connect(); $dbh->do("set autocommit = 1"); $dbh->{LongReadLen}= 1000000; # Set retrieval buffer for ($i = 0; $i < 1; $i++) { $k = 0; print "loop $i\n"; for ($t = 0; $t < 100; $t++) { for ($j = 1; $j < $opt_loop_count - 10; $j = $j + 1) { $s = fetch_all_rows($dbh, "select * from blobt3 order by b"); print "$s rows fetched\n"; $s = fetch_all_rows($dbh, "select * from blobt3 order by a"); print "$s rows fetched 2\n"; } } $dbh->do("commit"); } $dbh->disconnect; # close connection heikki@hundin:~/test> cat ibtest3c ############################################################################ # Stress test for MySQL/Innobase combined database # (c) 2000 Innobase Oy & MySQL AB # ############################################################################ use DBI; use Benchmark; $opt_loop_count = 1000; $opt_loop_count2 = 50; chomp($pwd = `pwd`); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; $dbh = $server->connect(); $dbh->do("set autocommit = 0"); $dbh->{LongReadLen}= 1000000; # Set retrieval buffer for ($i = 0; $i < 1; $i++) { $k = 0; print "loop $i\n"; for ($t = 0; $t < 100; $t++) { for ($j = 1; $j < $opt_loop_count - 10; $j = $j + 1) { $s = fetch_all_rows($dbh, "select * from blobt3 where c like 'kh d%'"); if (0 == ($j % 210)) { print "rollback $j\n"; $dbh->do("rollback") or print $dbh->errstr; } if (0 == ($j % 50)) { print "commit $j\n"; $dbh->do("commit") or print $dbh->errstr; } } } $dbh->do("commit"); } $dbh->disconnect; # close connection heikki@hundin:~/test> heikki@hundin:~> cat .my.cnf # Example mysql config file. # Copy this file to c:\my.cnf to set global options # # One can use all long options that the program supports. # Run the program with --help to get a list of available options # This will be passed to all mysql clients [client] #default-character-set=utf8 socket=/home/heikki/bugsocket #socket=/tmp/mysqld.heikki port=3307 #password=my_password #port=3306 #socket=MySQL # Here is entries for some specific programs # The following values assume you have at least 32M ram # The MySQL server [mysqld] #sync-binlog=1 #innodb_support_xa=0 #log #innodb_table_locks=0 #skip-safemalloc #bdb-no-sync #skip-innodb server-id=1 #default-character-set=utf8 #lower_case_table_names=1 language=/home/heikki/mysql-5.0/sql/share/english default-table-type=innodb log-bin=binlog set-variable = max_binlog_size=100M port=3307 socket=/home/heikki/bugsocket #skip-locking basedir=/home/heikki datadir=/home/heikki/data// #innodb_open_files=765 #set-variable = innodb_buffer_pool_awe_mem_mb=100 #set-variable = innodb_lock_wait_timeout=5 #innodb_force_recovery=5 #set-variable = innodb_thread_concurrency=8 #innodb_flush_method=fdatasync #innodb_fast_shutdown=0 # Uncomment the following row if you move the MySQL distribution to another # location #basedir = d:/mysql/ #set-variable = table_cache=256 #set-variable = sort_buffer_size=32M #set-variable = myisam_sort_buffer_size=384M #set-variable = read_buffer_size=32M #set-variable = read_rnd_buffer_size=32M #set-variable = tmp_table_size=384M #set-variable = thread_cache=8 #set-variable = thread_concurrency=2 #set-variable=key_buffer=35M #set-variable=long_query_time=5 set-variable=max_allowed_packet=8M #set-variable=low_priority_updates=1 #set-variable=query_cache_size=50M #set-variable=query_cache_limit=2M #set-variable=query_cache_type=1 # Uncomment the following if you are using InnoDB tables #innodb_locks_unsafe_for_binlog innodb_file_per_table #set-variable = innodb_force_recovery=6 innodb_data_home_dir = /home/heikki/data #innodb_autoextend_increment = 20 innodb_data_file_path = ibdata1:20M:autoextend innodb_log_group_home_dir = /home/heikki/data # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high set-variable = innodb_buffer_pool_size=512M set-variable = innodb_additional_mem_pool_size=10M set-variable = innodb_file_io_threads=4 # Set .._log_file_size to 25 % of buffer pool size set-variable = innodb_log_file_size=128M set-variable = innodb_log_files_in_group=2 set-variable = innodb_log_buffer_size=8M innodb_flush_log_at_trx_commit=0 set-variable = innodb_lock_wait_timeout=50 # InnoDB does a full purge and an insert buffer merge # before a shutdown. May be slow hope to solve problem #set-variable = innodb_fast_shutdown=0 #set-variable = lower_case_table_names=1 innodb_lock_wait_timeout=2000 #innodb_thread_concurrency=500 [mysqldump] quick set-variable = max_allowed_packet=16M [mysql] #default-character-set=utf8 #no-auto-rehash socket=/home/heikki/bugsocket port=3307 [mysqladmin] socket=/home/heikki/bugsocket port=3307 [isamchk] set-variable= key=16M [client_fltk]