· 8 years ago · Apr 15, 2018, 01:40 AM
1vcvars32.bat
2dumpbin.exe /headers mysqld.exe
3Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
4Copyright (C) Microsoft Corporation. All rights reserved.
5
6
7Dump of file mysqld.exe
8
9PE signature found
10
11File Type: EXECUTABLE IMAGE
12
13FILE HEADER VALUES
14 14C machine (x86)
15 5 number of sections
16 4E6A3CEF time date stamp Sat Sep 10 04:21:03 2011
17 0 file pointer to symbol table
18 0 number of symbols
19 E0 size of optional header
20 122 characteristics
21 Executable
22 Application can handle large (>2GB) addresses
23 32 bit word machine
24
25SELECT * FROM large_table ORDER BY non_indexed_column;
26
27SELECT * FROM large_table WHERE non_indexed_column = some_value;
28
29SELECT * FROM large_table WHERE some_column LIKE '%a_freqent_match%';
30
31DELIMITER $$
32
33DROP PROCEDURE IF EXISTS `test`.`eat_memory_until_server_crashes` $$
34CREATE PROCEDURE `test`.`eat_memory_until_server_crashes`()
35BEGIN
36
37-- this procedure is intended to eat as much memory as it can
38-- it creates a series of consecutively-numbered session variables as large
39-- as your configuration will allow them to be.
40
41-- do not run this unless you intend to crash your server
42
43-- also, do not run from a gui tool -- use the mysql command line client:
44
45-- mysql> CALL test.eat_memory_until_server_crashes;
46
47-- if you kill the query or thread before the server crashes,
48-- the memory consumed will be returned to the OS
49
50 DECLARE counter INT DEFAULT 0;
51 LOOP
52 SET counter = counter + 1;
53 SET @qry = CONCAT('SET @crash_me_',counter,' := REPEAT('a', @@max_allowed_packet)');
54 SELECT counter, @qry;
55 PREPARE hack FROM @qry;
56 EXECUTE hack;
57 DEALLOCATE PREPARE hack;
58 -- adjust timing or remove this entirely depending on how quickly you want this to happen
59 DO SLEEP(0.1);
60 END LOOP;
61
62END $$
63
64DELIMITER ;
65
66[mysqld]
67innodb_buffer_pool_size=1536M # limited by 32 bit
68innodb_buffer_pool_instances=2
69innodb_max_dirty_pages_pct=0
70innodb_old_blocks_pct=95
71innodb_old_blocks_time=50
72
73cd
74rm -rf SampleData
75mkdir SampleData
76cd SampleData
77wget http://downloads.mysql.com/docs/menagerie-db.tar.gz
78wget http://downloads.mysql.com/docs/sakila-db.tar.gz
79wget http://downloads.mysql.com/docs/world.sql.gz
80tar zxf menagerie-db.tar.gz
81tar zxf sakila-db.tar.gz
82gzip -d world.sql.gz
83cd menagerie-db
84mv *.sql ..
85mv *.txt ..
86cd ..
87rmdir menagerie-db
88mkdir sakila-db
89cd sakila-db
90mv sak* ..
91cd ..
92rmdir sakila-db
93rm -f *.tar.gz
94
95mysqlslap -uroot -ppassword -h192.168.1.1 --auto-generate-sql --concurrency=500 --number-of-queries=2000
96
97mysqlslap: Error when connecting to server: 1040 Too many connections
98
99mysqlslap: Error when connecting to server: 1135 Can't create a new thread (errno -1); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug
100
101SELECT CONCAT(table_schema, '.', table_name),
102 CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
103 CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
104 CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
105 CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
106 ROUND(index_length / data_length, 2) idxfrac
107FROM information_schema.TABLES
108ORDER BY data_length + index_length DESC
109LIMIT 10;
110
111mysqldump -uroot -p somedb bigtable othertable > bigtable.sql
112
113loadbigtables.bat 4
114
115@ECHO OFF
116SETLOCAL ENABLEDELAYEDEXPANSION
117
118SET BACKGROUNDJOBS=%1
119IF [%1]==[] SET BACKGROUNDJOBS=0
120
121ECHO.
122ECHO %0 with %BACKGROUNDJOBS% parallel background jobs
123ECHO.
124
125FOR /L %%i IN (0, 1, %BACKGROUNDJOBS%) DO (
126 ECHO %DATE% %TIME% Create database stress%%i
127 IF NOT EXIST stress%%i_bigtable.sql COPY bigtable.sql stress%%i_bigtable.sql
128 mysql -uroot -ppassword -e "DROP DATABASE IF EXISTS stress%%i; CREATE DATABASE stress%%i"
129)
130ECHO %DATE% %TIME% Create database stress0
131
132CMD /C "timeout /T 3 /NOBREAK" > nul
133
134ECHO %DATE% %TIME% Start...
135FOR /L %%i IN (1, 1, %BACKGROUNDJOBS%) DO (
136 START /MIN CMD /C "mysql -uroot -ppassword stress%%i -e ^". stress%%i_bigtable.sql^" "
137)
138mysql -uroot -ppassword stress0 -e ". stress0_bigtable.sql" & DEL stress0_bigtable.sql
139
140CMD /C "timeout /T 10 /NOBREAK" > nul
141
142FOR /L %%i IN (1, 1, %BACKGROUNDJOBS%) DO (
143 ECHO %DATE% %TIME% Drop database stress%%i
144 START /MIN CMD /C "mysql -uroot -ppassword -e ^"DROP DATABASE IF EXISTS stress%%i;^" "
145)
146mysql -uroot -ppassword -e "DROP DATABASE stress0;"
147
148ECHO %DATE% %TIME% Done.
149
150mysqlslap -uroot -ppassword --auto-generate-sql --concurrency=500