Tuesday, 6 May 2008

Make 'Exires' Go Away

Yesterday I posted about the useless 'Exires' [sic] header moss emits with content served from the content database under the default configuration. "Shame on you MOSS!" was shouted with just cause.

Nevertheless, I've found a fairly easy way to make 'Exires' go away and configure MOSS to emit better cache headers. It's pretty simple and while it will cost you a bit of disk space it should also save on roundtrips to the database server... all you need to do is enable the MOSS BLOB cache (aka Disk Cache).

The BLOB cache is turned off by default (for some reason) but when enabled it'll grab a copy of content database resources on the first request and cache them on disk for faster access down the road. Not only that, but, despite the name, the BLOB cache makes MOSS smart enough to emit good Cache-Control headers with your content.

The BLOB cache is configured through the web.config at the web application level, which leads me to believe you won't be able to set different max-age values for different types of content or different content groupings (let's say you want your .css and .js files cached with a different max-age value--or none at all--from the served with your images). If you're used to doing this with the content expiration mechanism in IIS at the folder or item level you may be out of luck here.

Enabling the BLOB Cache is ridiculously easy. Dig into your site's web config and find the BlobCache element (you'll need to do this on all related sites--i.e. anonymous and authenticated if you're running both on the same server). Set the enabled attribute to "true" and you're set. You may additionally want to modify the location where MOSS stores the BLOB data (i.e. a non-system disk), add extra file types to those already configured, and add a max-age="3600" attribute. The max-age attribute will be included with the Cache-Control header and is defined in seconds. Be careful with this one because if you set it to too large a value, your content will cached for the entire duration unless users clear their browser caches. Finally, the maxSize attribute defines the maximum size of the BLOB cache in gigabytes.


<BlobCache location="D:\MOSS\Cache\Consumer" path="\.(gifjpgpngswfcssjs)$" maxSize="1" max-age="3600" enabled="true" />

MOSS instruments the BLOB cache using performance counters you can access in Performance Monitor to determine cache health, turnover, etc.

If you get the BLOB cache working you should also consider reviewing the MOSS Output Cache. I'll save the details for another post but this cache extends ASP.NET output caching and deals solely with page content.

Monday, 5 May 2008

MOSS 'Exires' Header

Dear Microsoft,

What is an "Exires" header? I know what an "ExPires" header is but I have a feeling none of us (not even IE) know what to do with Exires.

Sometimes you've really got to wonder whether MOSS went through any form of QA whatsoever (and our system administrator often asks that exact question). Below is a set of typical HTTP response headers for a file requested from MOSS.

HTTP/1.1 200 OKConnection: Keep-Alive
Content-Length: 453
Date: Mon, 05 May 2008 04:44:34 GMT
Content-Type: image/gif
ETag: "{E4BBF3CA-94E3-44CB-A5CF-DD38E3330E11},3"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6219
Last-Modified: Wed, 19 Dec 2007 05:52:22 GMT
ResourceTag: rt:E4BBF3CA-94E3-44CB-A5CF-DD38E3330E11@00000000003
Exires: Sun, 20 Apr 2008 04:44:34 GMT
Cache-Control: private,max-age=0
Public-Extension: http://schemas.microsoft.com/repl-2

Note the useless Exires header. Without the extra 'p' this header is going to float right through any caches and will be ignored by the user agent. Not only that, but Exires is pumped out with most MOSS-based resource--that is any resource delivered from the MOSS content database (images, CSS, etc) excluding pages. Due to their size, images are great candidates for caching; likewise for the number of smaller files, like CSS and JavaScript, that otherwise clog up your page load times.

Friday, 11 April 2008

yslow for Performance Measurement

We're doing a fairly thorough performance/load time analysis of westernaustralia.com at the moment and I was recently introduced to YSlow in the process. YSlow originated at Yahoo! and works as a Firebug-dependent Firefox add-on.

In addition to using a combination of packet sniffing and DOM sniffing techniques to give you an accurate idea of how long the current web page takes to load, it also reports page weight, gives you information about page load weight from a primed and unprimed browser cache, tells you all about what's got an Expires header, what's got an etag, what's being gzipped, allows you inspect page components directly or at the header level, and grades the page overall. The grading system is backed up by a thorough set of recommendation for increasing the grade.

Apparently YSlow even fixes a bug with the Firebug net pane!

Definitely enough for me to add this to my toolkit--thanks Yahoo!

Global Submarine Cable Map

This is a very decent, high-resolution, free map of the submarine (undersea) telecommunication cables around the world. The date marked when I downloaded it this morning was April 2006.

Note: the file is about 22MB and there's also a .tiff file available.

http://www.pccwglobal.com/network-technology/pdf/1-Cable-Map-TM.pdf

Saturday, 22 March 2008

Windows 2008 Hyper-V

As I'm currently working for Diversus, a Microsoft partner, I was invited to attend the Heroes Happen {2008} event last Wednesday night. The invite promised a free copy of Windows 2008 (as well as Vista Ultimate with SP1--which ended up coming with a stinkin' 365-day license and a silly trial of Team Suite which I won't even waste my finger tips on--get real, Microsoft, and give us real stuff!) and knowing there would most likely be food and alcohol, I went along.

Despite Heroes supposedly being the simultaneous launch of Windows Server 2008, Visual Studio 2008 (which RTM'd late last year), and SQL Server 2008 (which isn't due to launch until Q3), the emphasis was squarely on Windows Server 2008 and Hyper-V. I've been using Microsoft's Virtual PC and Virtual Server tools for a few years now and after taking a close look at ESX Server lately, I was interested to see how Hyper-V would compete. I'm not a system admin or anything close but I reckon MS is headed in the right direction.

I wasn't sure the Heroes-supplied W2k8 disk would include Hyper-V; apparently Server will be sold with and without at a price difference of about $50. Why MS would do that is beyond me but I was pleased to see the Hyper-V check box listed in the Add Roles Wizard (Hyper-V is still in beta but the beta has been included with the Windows Server 2008 RTM build). The final Hyper-V release is supposed to be available on Windows Update around the same time SQL Server 2008 launches.

As a natural geek, I've got a handful of old PIII and PIV boxes lying around the place serving various roles within my home network. There's one box for AD/DNS/DHCP, another working as a dedicated file server, and others configured as web and database servers. By contrast, SharePoint being SharePoint, everything I do in relation to said software has been within a virtualised environment and it's been that way for a while now; I can provision new VPCs and backup existing VPCs as required. Having had success with Virtual PC and Virtual Server, I figure it's time to virtualise as many boxes as possible. I'm a Green at heart and running running multiple boxes in my small home office makes a hot Aussie day even hotter ;-)

The Heroes media included 32 and 64-bit editions of Server 2008 so I figured I'd go 64-bit just for fun. Apart from a few extra folders and Control Panel items referring to 32-bit, I haven't noticed a differece. The host box is only used as a server so I don't have weird hardware running and everything was detected automatically by the installer. Speaking of the installer, it's wonderful! Select your location and go. Not long after, the OS fires up and you do all the stuff you used to be promted for within the installer. I installed Hyper-V post-installation and everything went, um, fine... see below.

Apparently Hyper-V is supposed to be a "bare metal" (Type 1) hypervisor coming in at 650KB in size; I'm not entirely clear whether Hyper-V can be installed on a Windows Server Core base but at this point I'm still looking at Window and it's sitting right there between the metal and the virtualisation components. Apart from that, it seems like a pared-back version of Virtual Server: the admin screens are very simple and it just works.

I did have one issue after firing up the Hyper-V console for the first time: the Virtual Machine Management service wouldn't start and I had no idea why. Apart from a less-than-helpful UI error on attempting to start the service, the following event entry was logged:

The Virtual Machine Management service terminated with the following error:
The parameter is incorrect.


Luckily Ben Armstrong and Joe Hemmerlein from Microsoft were kind enough to weigh in on the discussion of this issue and pointed me in the right direction. As a I reside in Australia, I naturally selected English (Australia) as my location when I installed Windows but apparently that's not good enough for Hyper-V and it only likes the US. The link above goes through the configuration of your regional settings and language options to get the VMM service running without a Windows reinstall. I changed all my settings back to Oz after things started working but that's no good either: starting up the box today the VMM service failed again. This time I managed to get the service started without having to remove the role: I simply went through the necessary regional/language option config steps, applied to all accounts, and rebooted. I've since changed my account and the default account back to Aussie, leaving the System Accounts as they are. Long story short: this is really annonying and I hope Microsoft fixes this before launch.

After that rigamarole, I installed Windows Server 2008 in a VM, giving it 1GB of RAM (I've successfully installed 2003 on 128MB but Vista has made me wary). Performance at the UI hasn't been too zippy but this is a VM after all.

In the virtual world, I installed the AD role and it was a painless affair. I also turned off IPv6 because I don't know enough about it and those 128-bit hex addresses aren't going to give me much on a home network. DHCP was next and it too was uneventful. As mentioned previously, I'm not a system admin or a network engineer or a network anything--I was suprised when I managed to install AD on Windows 2003 so easily a few years ago and I've noticed the process is that much easier in 2008.

And so the network build continues. I'll soon be whacking MOSS onto a 2008 box for the fun of it and I'll let you know how that goes!

Great Subnetting Tutorial

The link below provides superb, in-depth information about IP addresses and subnetting. All the basics are covered: the breakdown of IP address ranges by class, converting decimal IP addresses to binary, and so on but lesson 6 explains subnetting more clearly than I've ever seen it explained. The author also covers routing and communications and the diagrams make it all as clear as possible.

You have to register to view the article but even if you think you understand subnetting, it's worth it.

http://searchnetworking.techtarget.com/tip/0,289483,sid7_gci1016859,00.html

Friday, 21 March 2008

Say Goodbye, Google AdSense

By the number of ads on this page you may have noticed I'm a Google AdWords user. I realised today it's been nearly a year since I signed up--mainly to track basic statistics and hopefully make a buck or two from page views.

On the stats side I've been very happy. I've watched my "readership" (or number of click-in/click-out visitors, at least--I've got no idea how many of you actually read what I write let alone who subsribes to this blog) grow steadily over the past year and it's been exciting to consider the off chance that some of you actually find my posts helpful or interesting or both.

On the financial side, however, I'm quite disappointed. As I expected, visitors don't click the AdSense links and as a result I've made a grand total of $0.63USD this year. Wow--luckily I'm not in it for the money! A New York Times article suggests only one in every six blogs receives 500 or more page views per day and at that rate you're looking at $45 a month. It's conceivable I've misconfigured something along the way but I've never found it that hard to use any of Google's numerous applications and it really shouldn't be that hard anyway.

Moreover, for all the extra clutter AdWords contributes to my blog and the internet in general, I've decided it no longer cuts the mustard. I've decided to remove the sprinkling of AdWords panels from the right column and leave a single ad in the footer of each page to continue tracking visitors. Harsh, but considering I can grab a free page tracker from anywhere, I perceive no value filling Google's coffers for minimal return.

Sunday, 2 March 2008

Content editor web part dislikes neutral cultures

With the CurrentUICulture property of the current thread set to a neutral culture like 'de', attempting edit the content in a MOSS Content Editor Web Part results in the following exception:

Server Error in '/' Application.

Culture 'de' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Culture 'de' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thr...

Very boring. On a hunch, I think you can probably get around this by using a specific culture but that may not be possible in very case. This was only an issue while in edit mode, for us, so I got around it by simply setting the CurrenUICulture as en-US whenever a page is in edit mode. Kind of a cheat but our content editors are all English so it doesn't matter.

Thursday, 28 February 2008

How To Determine Which Version of MOSS 2007 is Installed

Need to determine which version of WSS or MOSS has been installed on a server?

The easiest way to get the current version number is to browse to the Site Settings page (eg. for your Central Admin site): http://myserver:ca_port/_layouts/settings.aspx.

You can also hit the database:

SELECT [VersionId]
,[Version]
,[Id]
,[UserName]
,[TimeStamp]
,[FinalizeTimeStamp]
,[Mode]
,[ModeStack]
,[Updates]
,[Notes]
FROM [SharePoint_Config].[dbo].[Versions]
WHERE VersionId = '00000000-0000-0000-0000-000000000000'
ORDER BY Id DESC

The version numbers correlate with the more familiar release names listed below (note these version numbers differ from what you might see through the Add or Remove Programs applet or a DLL version):
  • MOSS Beta 2: 12.0.0.4017
  • MOSS Beta 2 TR: 12.0.0.4407
  • RTM: 12.0.0.4518
  • August 24 2007 Hotfix Package: 12.0.0.6036
  • SP1: 12.0.0.6219
These version numbers are supposedly the same for both WSS 3.0 and MOSS 2007 but I don't have a pure WSS environment to confirm that.

If your installation isn't running and you can't access the CA site, check out the following links to learn about alternative means to find the current version number.
 

Wednesday, 20 February 2008

Deploying SharePoint DLLs to the GAC

Deploying the DLLs in a SharePoint solution to the GAC is pretty straightforward.

Firstly, ensure the assembly is signed by opening the Signing tab on the project properties in Visual Studio. Create a new key file (no password) and make sure the Sign the assembly box is checked. If you do this, you don't need to go through the whole sn -K and AssemblyKeyFile attribute process--Visual Studio takes care of it all.

Next, open the solution manifest (the SharePoint solution, not the Visual Studio solution...) and change the value of the DeploymentTarget for the DLL to be GAC'd from WebApplication to
GlobalAssemblyCache.


Rebuild your CAB file and re-deploy specifying the -allowGacDeployment stsadm flag with the deploysolution operation. Browse to %windir%\assembly and your GAC'd assembly should be present. The local \bin directory won't contain the DLL in question.

What about debugging and symbol (pdb) files? Apparently they can remain in the \bin directory but I haven't had much joy with this myself. Instead, I map a drive to \\{machine_name}\c$\windows\assembly\gac_msil\{version_publickey} and copy .pdb files across either manually or using a deploy script (see my debugging tricks).