1 |
On 7/21/2011 2:50 PM, Grant wrote: |
2 |
>> |
3 |
>> Any reason you're still using MyISAM tables? Innodb is almost as fast |
4 |
>> or much much faster than MyISAM in nearly every way these days. |
5 |
> |
6 |
> Can multiple processes be utilized for mysql like they are for |
7 |
> apache2? Perhaps not since it's a database? |
8 |
|
9 |
Mysql is multithreaded and spawns a thread for each connection. Try a |
10 |
ps -efL and you should see a number of Mysql threads. However that is |
11 |
part of the problem with MyISAM. It throws a giant table lock blocking |
12 |
all other threads until the SQL statement is complete. Innodb uses row |
13 |
locks which allows the other threads to use the table. |
14 |
|
15 |
As far as moving to Innodb tables it's actually easy, but with a number |
16 |
of caveats. I'd lower your Apache max clients, tweak my.cnf, and runs |
17 |
some load tests before getting deep into Mysql. When you're ready I'd go |
18 |
about this way. |
19 |
|
20 |
1. Make backups first. |
21 |
2. See if you have any full text fields. Tables with full text fields |
22 |
will have to remain MyISAM. |
23 |
3. Dump your database out to text. If it's not a huge amount of data I'd |
24 |
just vi it and change the ENGINE to Innodb. Then import the whole thing |
25 |
as a new database. If you have a lot of data, I'd dump the schema with |
26 |
-d edit, import schema, then dump your data with no create statements |
27 |
and finally import the data into the new database. |
28 |
4. Point your staging code to the new database and test |
29 |
5. Plan a maintenance window to do all the above and take the site |
30 |
offline while you reimport the data to be Innodb |
31 |
6. take the RAM you gave to key_buffer and give it to innodb. Storage |
32 |
engines do not share buffers in Mysql. |
33 |
|
34 |
You can alter tables in place, but it locks them for the duration. If |
35 |
you site is small and low traffic you could get away with it, but |
36 |
testing with a copy of your site database is better. |
37 |
|
38 |
kashani |