Reading up on Windows Server 2008 R2

For reasons I would rather not into detail about, I had to help with setting up a Windows Server 2008 R2 machine. Researching this, I found this great video on Channel 9 from PDC 2009 by Mark Russinovich: Windows 7 and Windows Server 2008 R2 Kernel Changes Part 1 and Part 2.

Here are a couple of the key takeaways from that talk from a performance point-of-view.

Timers

It’s been said before and even made it into a Forbes article, but it’s worth repeating, because many applications (even major ones) get it wrong anyway:

Don’t mess with the system timer resolution (via timeBeginPeriod) because it will increase overhead and thus reduce performance.

I remember having a system where Sysinternals ClockRes showed the timer resolution being way higher (i.e. lower tick interval) than it should have been. Unfortunately, I had no idea what application was responsible for this. In Server 2008 R2, however, one has a way of finding out:

powercfg.exe -energy duration 5

This will produce an HTML report showing you a couple of things that can have an impact on your system’s power consumption (and performance), including the processes that changed the timer resolution.

Power Plan

Also in this report is your system’s power plan. The default is Balanced, which may not be the best choice under certain circumstances. I found a couple of good articles on the topic:

Scott Hanselman’s blog post in particular left me convinced that High Performance was the way to go, given my intended use for this server is pretty close to what he described.

Dispatcher Lock Gone

In my own testing I noticed that the same application on Windows Server 2008 R2 was scaling much better with more threads than it did on Windows Server 2003 (R2). I’m not sure I have (the absence of) the dispatcher lock to thank for that, but I here’s what I noticed:

  • On Server 2003, multiple threads would not use all of the available CPU, and queues of outgoing messages would built up. Distributing the work over more threads did not improve overall throughput.
  • On Server 2008 R2 with the same number of threads, there were no queues in data processing and we reached a limit only when the NIC exceeded 90% utilization.

This was far better than I had expected. To be fair, I have not tested to what degree the increase in performance can be attributed to newer hardware versus the newer operating system. But since I can’t have one without the other, I don’t think it matters.

A Cautionary Tale

I am not entirely sure whether this is related to the absence of the dispatcher lock, but migrating to Server 2008 R2 also revealed a very nasty concurrency problem in one application. The code had been running fine for many years on Server 2003, but failed rather quickly on Server 2008 R2. My guess is that the increased degree of parallelism in 2008 R2 just made it more likely for the race condition to reveal itself.

It also shows that upgrading from 2003 to 2008 R2 (or newer) does require some testing. Even though I have not run into any APIs that were changed, there appear to be subtle timing changes such as this one that could make an application stumble.

Conclusion

I was pretty amazed how much better our Server 2008 R2 machines performed compared to the old 2003 machines after checking the settings mentioned above. If there are other’s I have missed, please leave a comment.

I still have to research the changes coming in Server 2012 (R2), maybe Windows Server got even better in that version.

Experimenting Some More

Normally, on a Sunday like this I would go running in one of the nearby parks. However, a month ago Düsseldorf was struck by one of the worst storms in recent history and about 17 000 trees in this city alone were destroyed or damaged.

The fire department (helped by other emergency services and even combat engineers from the army) did a tremendous job clearing the streets and allowing public transportation to resume within a few days. Despite the severity of the storm, the impact on public life was rather low.

The city’s many other patches of green including the parks I use to go for a run, though, are still not entirely safe again. So many of them have been closed off to the public out of fear that some loose branches might fall down (although I haven’t heard of anybody getting injured after the initial storm).

So instead of running, I took out my camera and shot what the areas I would usually run at looked like. Not a pretty picture.

Panorama Black & White

Detail Black & White

On a more positive note, here’s a shot I did experimenting with my new 18-250mm lens last week. After borrowing my father’s lens a while ago, I was so taken with its possibilities, I just had to get my own.

By the way, the bottom picture in that post was taken in the same park (though not the same spot) as the ones above. Once the park is accessible again, I’ll try to recreate the shot. I’m afraid there is going to be considerably less green there.

Smart Herb Garden

One of the most fun projects I backed on Kickstarter has been Smart Herb Garden from Click & Grow.

I don’t cook a lot; in fact I barely spend any time in my kitchen. But still, I’ve been very excited about watching this thing grow. The first batch of seeds I’ve “planted” was Basil, Mini Tomatoes and Salad Rocket.

Below are a couple of pictures documenting my garden grow. I’ll update this page as time goes on and harvest approaches.

18 April 2014: Unpacking

Smart Herb Garden

13 May 2014: Seeds planted

Smart Herb Garden

21 May 2014: First Green

First Green

25 May 2014

Smart Herb Garden

29 May 2014

Smart Herb Garden (1)

Miscellaneous

At night, the light casts a very interesting pattern onto the ceiling of my kitchen.

Lichteffekte

Random Pictures

If I were asked what my hobbies were, I probably wouldn’t list photography among them. Nonetheless, I like to grab my camera every now and then and take some pictures. And sometimes, I even like to sit down afterwards and fiddle around a bit in Photoshop Elements to touch them up.

Here is a random selection of some of the more recent ones. I take most of my pictures while traveling, so you’ll find them included with one of my Travel posts.

In Orbit von unten

Frische Luft und Kamillentee

Dach

The Case of Metro Apps not Starting and Failing to Install

Inactive TileI don’t not how this got started, but at some point I noticed that more and more Metro apps (or Modern apps or Windows 8 apps or whatever you want to call them) were no longer working properly. I haven’t been able to locate a solution online, so I figured one out myself and document it here in case someone encounters the same problem.

The Symptoms

Failed InstallationsLive tiles on the start screen were no longer showing updates, but instead had an X in the bottom right corner (see screenshot at the top). When started, these apps would either briefly display their splash screen and then terminate, or go back straight to the desktop.

Also, the apps no longer updated, showing the following error messages in the Windows Store (see screenshot on the left) and varying error codes, such as 0x80070002 or 0x80073D05.

Looking for Answers

I found descriptions of similar problems online, and even this quite comprehensive selection of fixes. Unfortunately, none of them worked for my particular case.

So I dug around in the Windows event log. Recent versions of Windows actually store quite a lot of information in there. And it’s much better structured than in earlier releases that lumped most events into just three sections: Applications, Security and System.

From my online research I knew that apps were being installed by a process called AppX deployment. So I looked through everything mentioning that in the event log and I found this error under Application and Service Logs\ Microsoft\ Windows\ AppXDeployment-Server\:

Cannot register the request because the following error was encountered during the registration of the windows.stateExtension extension: An error occurred while deleting the package’s previously existing application data.

Event Viewer

Further research online showed that there are two locations where apps store data (possibly more that I don’t know of):

  • On disk: C:\Users\<YourUserName>\AppData\Local\Packages
  • In the registry: HKEY_CURRENT_USER\ Software\ Classes\ Local Settings\ Software\ Microsoft\ Windows\ CurrentVersion\ AppModel\ SystemAppData\

The Cause

Turns out, it was data in the registry that was causing problems. I’m not sure how this is related, but in each of the affected apps’ keys there was an “invalid DWORD (32-bit) value” named STATE_LEFT_FROM_LAST_UNINSTALL. None of the working apps seemed to have had this value.

image

As I was trying to access the sub-key “PSR” of one of the applications that wasn’t running, I got the following error. Deleting the key didn’t work either.

image

image

Since I was denied access (though I had started regedit as an administrator), maybe the installer was denied access, too. Checking the permissions, I got this message and then an empty permissions dialog.

image

image

The Solution

I couldn’t change the permissions for the app’s PSR in this dialog right away and I couldn’t even view the owner (under Advanced). But I could take ownership of that key and then I was able to grant myself full control over the key. And with full access I was now able to delete the key for the app, including the PSR key.

After I had repeated this for each one of the affected apps, I went back into Windows Store, retrying the installation. And lo and behold, all apps installed correctly and are now working properly.

Aftermath

I never found out why the permissions on those registry keys got messed up. I just know that through the process described above, I have got all my apps working again.

Unfortunately, I still have a problem with the OneDrive and Photos apps on Windows 8.1 as described in this post on the Microsoft support forums. But since OneDrive and Photos aren’t apps that are installed via the Windows Store, the above trick does not work on them. So I’m still trying to figure that one out…

Düsseldorf Skyline

Stadtpanorama

I don’t know what it is about this picture, but I just really love it. It so wonderfully captures the atmosphere of a perfect Saturday night last week.

I didn’t even need to edit it much. It’s just two pictures I took with my phone (a Lumia 920) stitched together and cropped, with a little bit of sky generated in the top left corner in Photoshop.

WP_20140503_002 WP_20140503_003

A few Days in Amsterdam

As I was putting together Travel Plans: Capitals of Europe, I noticed that I had never posted anything from my Amsterdam trip. That trip was in June 2013 and it is now April 2014. Better late than never, I suppose.

Vondelpark

The feature of Amsterdam that made the most lasting impression on me was Vondelpark. I love cities with good public parks, but I hadn’t set out to find this one. It was just a lucky coincidence that my hotel was right outside the park and I still had an hours or so to kill until my room was ready. In the end, I went to the park every single day of my stay, walking around it or just sitting down to read/watch the people around me.

I was reading Capital at the time, very, very good book by the way, almost kept me from ever leaving Vondelpark and exploring the rest of the city. Shortly before I had been reading Jane Jacobs’ The Death and Life of Great American Cities, particularly the section on what makes good parks, and I think Vondelpark checks most, if not all of those boxes. I took a couple of pictures, but none of them really capture what was so great about the park; all these different people on foot or bike, going about their business or just passing through. Really quite wonderful.

Around Town

Unfortunately, the weather wasn’t too good the two days I stayed in Amsterdam, so these photos are all a bit gray, alas.

Gratchen

Rijksmuseum

Joordan

Westerkerk

Blick von der Westerkerk

Random Observations

A funny combination: a New York City taxi cab, with Düsseldorf (Germany) license plates on the streets of Amsterdam.

NYC Cab from Düsseldorf in Amsterdam

I noticed this in Luxembourg as well: their Fanta Orange – one of my favorite soft-drinks – is so much paler than the Fanta Orange we have in Germany.

Pale Fanta