Speeding up Drupal on Microsoft Windows

For 7 months I know how slowly the Drupal 7 worked on the localhost(Windows 7).

I tried all sorts of optimization but nothing worked.

I used Devel module to see the mysql query log. And I always saw that it was mysql which was the bottleneck.

The final turn around came when I hit upon this mysql optimized config. I want to salute this person to have ended all my woes. Now my localhost Drupal 7 is pretty fast!

I suggest you start with this config and then ticker is one by one. If you change innodb_log_file_size then you must remove ib_logfile from mysql data directory on Linux or Windows before you restart mysql otherwise it will throw an error.

Hardware Config

I've a Intel i3 530, 8 GB RAM, 1 hard disk.

Optimization

Here is the ultimate Drupal optimization blog. But remember the above optimized config file will improve site speed on Windows by 99%.

Here is simple and general check list I've prepared for the production server:

  1. In mysql set cache buffer and cache query to highest value
  2. Set up APC (It crashes on my Windows so I don't use it, but do use it on Linux)
  3. Turn on Drupal Caching in Performance tab
  4. Turn on Views caching( query etc)
  5. Set mod_deflate in Apache
  6. Turn on Keepalive in Apache but if memory is less then turn it off. KeepAlive is off by default. To on it go to WHM->Apache Configuration and turn it on. More at here.
  7. Try to use DSO php handler in CPanel. But then you'll need to do chmod 777 in the public_html and all files/folders below it.
  8. Turn off mailmain, spamassisin( in 2 places, one in Tweak settings), IMAP. This will heavily reduce VPS memory usage.

Here is the approx mysql inno db settings which I'm using:

  innodb_buffer_pool_size = 1024M

  innodb_flush_log_at_trx_commit = 0

  query_cache_size = 4M

  innodb_flush_method = O_DIRECT

  innodb_log_file_size = 32M    
#( before restart run this command else mysql error will occur : rm /var/lib/mysql/ib_logfile* )

  innodb_log_buffer_size = 4M

  join_buffer_size = 8M

  sort_buffer_size = 3M

  query_cache_limit = 256K
  tmp_table_size = 64M

  max_heap_table_size = 64M

  table_cache = 4096

  thread_cache_size = 128

  wait_timeout = 300

  table_definition_cache = 4096

  table_open_cache = 16384

Backup

Last but not least backup up you site, database before you do anything. You must be able to restore it! To backup mysql, you can simply backup the data folder in Windows under mysql. You can also use drush arb commad which is easy.