Latest sites

Quick news

  • 2014-03-27: MongoDB Watchdog module ported to Drupal 8 at the Szeged Dev Days.
  • 2014-01-26: My post on the Symfony web profiler in Silex selected in Week of Symfony. w00t !
  • 2013-10-18: My first commit went into MongoDB today. And, guess what ? It's in JavaScript
  • 2013-09-20 to 29: Working on Drupal 8 EntityAPI at the extended code sprints during and around DrupalCon Prague
  • 2012-08-19: Working on Drupal 8 EntityAPI at Drupalcon Munich
  • 2012-06-15: Working on Drupal 8 EntityAPI at DrupalDevDays Barcelona
  • 2012-03-23: Working on the future Drupal Document Oriented Storage at DrupalCon Denver. D8 or later ? Bets are on Later

Speeding up Drupal on Vista with Wampserver

The problem : Drupal awfully slow on Vista (and Seven) with Wampserver

For some time now, I'd been severiously annoyed by the (utter lack of) performance of Drupal 6 and 7 on my home PC, which happens to be running Microsoft Vista: considering I was used to getting page times around 200ms on a fractional Celeron with Apache 2.2 on a Linux server hosted comparatively far across the net from that same machine, I felt the 5 to 15 seconds response time per page on this local machine with a quad core and 3 GB RAM were really making me lose my time.

The solution

After some time spend googling around, I stumbled upon an incredibly simple tip, which made the 5 to 15 seconds per page drop down to around 1 second when logged in, and well below 500 ms when not logged in. It's incredible what ONE single character in a plain text file gets you under Vista :-)

UPDATE 2010-01-23: David Hogg tells us (see below) that this works for Windows Seven too

So, without further ado, here is this little gem : add a sharp character ('#') as the first character of the line containing: ::1 localhost in your c:\Windows\System32\drivers\etc\hosts and save it. If your machine is anything like mine, your Drupal response times should all of a sudden be divided by a factor between 5 and 10.

More detail

What this smallish change does is remove IPv6 localhost resolution from the hosts file. It is likely to cause other problematic situations if you do any IPv6 work, of course, and then you'll probably want to dig deeper into your network and/or Apache config.

Can't write to the hosts file ?

The mandatory access control feature of Windows Vista prevents normal programs from touching this file, even when you are logged in to an administrator account with all privileges. This means that your favorite text editor will load the file read-only and be unable to save your changes. To prevent this from happening, you must start the editor as Administrator. Unless you disabled it, the UAC window will ask you for confirmation, which you will have to give to your editor instance. After that, you will be able to edit the hosts file normally.

So will this work with XP?

Thanks for the above. The speed of my local wamp server for Drupal 6.x is depressing. Wonder if this sort of trick can be done for Windows xp?

Not applicable to XP

The XP hosts file does not contain any IPv6 information by default, so that tip cannot really apply.

Thanks!!!I changed"::1

Thanks!!!

I changed
"::1             localhost"
to
"#::1             localhost"

in C:\Windows\System32\drivers\etc\hosts

and it worked like a charm for me in Vista!!!

hello,there is no line ::1

hello,

there is no line ::1 localhost on my host file. furthermore, even if I start notepad with the admin rights, I still can't save the files.

Could you help me, please?

Regards,
Xavier

Is it really Vista ?

I'm afraid I don't have a clue: unless you (or some other person or software) tampered with your OS install, that line should be there. Also, starting an editor with admin rights (which doesn't just mean start it from an admin account) should allow you to save the hosts file (not host, is it a typo ?) back.

Maybe you have some so-called "security" software installed, which prevents you from administering your system ?

Thank you!

Wow, that makes an incredible difference!
This has just sped up my workflow dramatically and rescued my waning patience.

Vista and IPv6

You might also have a look at -> http://www.ipv6day.org/action.php?n=En.Configuration-WindowsVista

- cheers

Same problem here

My file has only one uncommented line

127.0.0.1 localhost

I added #:: to it for a small improvement

oh yeah...

you need to uncheck the "read-only" box in the properties of the file.

This shouldn't change anything

Commenting the normal 127.0.0.1 localhost entry shouldn't do you any good, quite the contrary.

The only point of this change, and only on Vista, is to disable a non-operational IPv6 resolution for localhost, but 127.0.0.1 is an IPv4 address.

Vista Drupal Slow

Thx man, I thought, what is this, so slow...

Works on Windows 7 too!

Installed the latest Acquia Drupal stack on my 64 bit windows 7 machine. Worked - but very slow response. Your one character fix worked like a charm! Thanks.

eAccelerator

Has anyone had any luck installing eAccelerator with DAMP on XP or Vista ? This should speed some things up as well, but I haven't yet located a windows version of the latest release of eAccelerator (0.9.6) to use with PHP Version 5.2.13.

This should be unrelated

eAccelerator, like APC, is an opcode cache, which saves time by not-reparsing PHP code on every page. This is really unrelated to the issue mentioned here, which is about the delays caused by non-optimal IPv6 (mis-)configuration, not about PHP itself.

Turn off User Access Control (UAC) to edit hosts file...

In order to save changes to the "hosts" file, temporarily turn User Account Control off.

Turning off UAC not needed

Turning off UAC allows any program to edit otherwise protected files likes ...etc\hosts, but this is really not needed: just run your editor as administrator. That way you will not be dropping /that/ protection and won't risk forgetting to restore it afterwards.

d.o

drupal.org has a page regarding this very subject, if anyone would like to add or edit please see

http://drupal.org/node/961012

Host file

My host file already had the hash mark before the mentioned line.

guess I will just have to abandon local Drupal dev and do it on a server.

I have read many thousands of lines on this subject but not a working fix in site.

:(

Why remain on Vista ?

I still use Windows to run Adobe CS5, as well as some business apps without a Linux equivalent, but for all dev work, I run on Linux. At work, it's on one LAMP Samba server (really an older PC I no longer use) with Zend Studio on my Windows box working on the files on the server, and at home or on my laptop, I just dual-boot into Ubuntu: then everything falls into place; Studio is faster, every Linux tool I'm using is there, and so on.

Some would advocate virtualization, but I tend to find that every serious work session uses just about any last percent of the resources of the non-virtualized machine, so I would not recommend this. OTOH, most of my projects implement not just LAMP but also Memcached, MongoDB and Varnish, because they are tied to larger customer projects, which is probably not completely typical in terms of hardware requirements. As you may have noticed, many Drupal devs tend to use Apple Mac, which gives them the benefit of an efficient Unix+AMP stack combined with top design tools (meaning especially CS5 for design and Omnigraffle for diagrams).

But, eventually, you can even get decent Drupal performance on Vista/Seven too: just use WIMP (IIS instead of Apache) instead of WAMPserver, possibly from the Zend Server Community Edition, and by all means tune your MySQL server: most Windows distributions use MySQL settings totally inappropriate to Drupal work.

Tnks

Tnks! Not only for drupal

Solved my localhost speed issues with Drupal 6 and 7

Hi,

I just wanted to say that turning off Ipv6 using the settings suggested in this blog helped my problem greatly reducing 30 secs refresh at times during development to around 10-15. I had tried everything suggested that I could find and had resigned myself to the fact that I was just going to have to live with the 15 secs it took for my PC to reload/refresh as I develop.

My laptop is quite a high spec dual core and the processors and ram very rarely hit 100% so I couldn't understand why I was getting such poor performance with Wampserver.

Last week I swapped out my HDD hard drive for a SSD solid state drive and I can't believe how fast my laptop is now. Page refreshes that previously took 30 secs and timeouts now take 2-5 secs. Absolutely brilliant. For an outlay of £160 for a 256 gb ssd I really couldn't be happier. Added benefit is Windows loading/shutdown takes about a third of the time too. It's like having a new laptop.

Certainly worth considering if you have tried all the other tweaks first.

Cheers