Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am working on the design of a Wordpress blog which when finished will almost-always serve pages from disk cache and this is because all posts will be published in batch and then cached, with at least 5 hours between batches.

Database size is only 30MB at the moment as this is a new blog.

My server options are two:
a. Either a 4GB RAM server with an SSD or
b. An 8GB RAM server with a normal HDD.

Am I right in assuming that since pages will almost-always be served from disk cache, SSD is a better option?

Or maybe I should still go for more RAM?

I ask because years ago I worked on a blog generating almost 2m pageviews per month and when it was crashing we identified the heavy HDD usage as the problem. In fact after tweaking innodb_buffer_pool_size so as to use more RAM and less disk, we never had any more issues.

Thank you.

Edit By RolandoMySQLDBA

Please run this query

select var,concat(numunit,' ',unit) size from
(
    select var,format(num/power(1024,ex),2) numunit,SUBSTR(units,ex*2+1,2) unit
    from
    (
        select var,num,FLOOR(LOG(IF(num=0,1,num))/LOG(1024)) ex
        from
        (
            select variable_name var,variable_value*pagesize num
            from information_schema.global_status AAA,
            (
                select variable_value pagesize
                from information_schema.global_status
                where variable_name='innodb_page_size'
            ) BBB
            where AAA.variable_name like 'innodb_buffer_pool_pages%'
        ) AA
    ) A,(select 'B KBMBGBTB' units) B
) M;

and post its output so was can see the Buffer Pool's current usage.

Also, please run SELECT VERSION();

Edit

The blog is still on the development machine so I believe the first query is of no use. I can provide the result of the second though:

+------------+
| VERSION()  |
+------------+
| 5.6.16-log |
+------------+
1 row in set (0.03 sec)

It will be the very latest version when we go in Production.

share|improve this question
1  
How much data are you planning to store? If you have far less than 4GB of data in the database, probably adding more RAM than that won't have as big a performance advantage as using an SSD. If I had my way, I'd go for both SSD-based storage, and as much RAM as I can afford since RAM is pretty cheap. –  Max Vernon Aug 12 at 14:32
    
Exactly, the blog is 100% new so it will take months before the databases reaches 3-4GB, maybe more than a year. –  WPRookie82 Aug 12 at 14:35
1  
Will the database be on it's own machine, or will the entire stack of software be on a single machine? –  Max Vernon Aug 12 at 14:41
    
All on the same server, Max. –  WPRookie82 Aug 12 at 14:41
    
@MaxVernon LAMP on 4GB ?? Argh !!! Nonetheless, that was a good question. –  RolandoMySQLDBA Aug 12 at 14:42

1 Answer 1

If you are going to put MySQL in a wimpy environment (WIMP = Windows, IIS, MySQL, PHP/Perl/Python), your first priority needs to be RAM. Please get more RAM on the box.I suggest 32GB.

As for MySQL, you need to tune InnoDB as much as possible. Here is the InnoDB Architecture

InnoDB Architecture

InnoDB Architecture

Recommendation #1

By default, 25% of the Buffer Pool is used to process changes to secondary indexes. Thus, I suggest double the amount of data (you said 3-4 GB) as the Buffer Pool Size

innodb_buffer_pool_size = 8G

Recommendation #2

Since you have a dual core machine, split the Buffer Pool to prevent swapping

innodb_buffer_pool_instances = 2

Recommendation #3

You will need good read and write I/O threading

innodb_read_io_threads = 16
innodb_write_io_threads = 16

Recommendation #4

You need to the Log Buffer to be larger for increased write performance

innodb_log_buffer_size = 64M

Recommendation #5

You need the Log Buffer flushed often since you are in Windows

innodb_flush_log_at_trx_commit = 1

CAVEAT #1: The default for innodb_flush_log_at_trx_commit is 1 to maintain ACID compliance. Do not change this in Windows since Windows has the final say on disk caching.

CAVEAT #2: There is an option for InnoDB to cache data instead of letting the OS do it called innodb_flush_method. Unfortunately, the setting O_DIRECT is not available for Windows. If you switch to Linux, setting this option takes disk caching by the OS out of the equation.

Recommendation #6

Sequential and Random Reads from SSD can be the same or a mixed bag depending on the model SSD you get. If your IOPs exceed 10,000, you can change innodb_io_capacity to 10,000 and innodb_io_capacity_max to the maximum IOPs.

Summary

Get 32GB of RAM for the WIMP machine and use these setting in my.ini

[mysqld]
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances = 2
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 1
innodb_io_capacity = 10000
innodb_io_capacity_max = (Maximum IOPs of the SSD)

Alternative to SSD Only

If you are will to configure it, there is a design that a Facebook Engineer uses to split up InnoDB tables and logs to lengthen the life of the SSD by writing the sequential stuff for InnoDB (Double Write Buffer, Log Files) to a fast HDD.

I have discussed this before

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.