Feb 26 2008

Server 2008 out performs Server 2003 by a mile

After multiple tests, I can happily say with out any doubt in my mind that 2008 server blows 2003 server in terms of web performance out of the water… How do I come to this conclusion you ask?

If you have been reading up on my partner in crime’s Blog (Alan Lee) and Craig Baileys blog we have been performing some extensive bench testing on the servers. Alan within his blog describes the method that we have used to perform our testing, which in brief is a Linux command which does a simple WGET mirror of the home page this mirror copies all the contents locally and then removes it after the crawl is complete, within the mirror command it also copies all other associated links on the home page (there is roughly 13 links which means it copies another 13 pages and associated images). 

One WGET, from the Elcom home page would receive a rough total of 6.4MB which with today’s bandwidth speeds and abundance of images and multimedia everywhere we look this is not a huge number, its what we would call realistic.

The test, the script was set to run 20 concurrent connections 1,000 times. Again 20 concurrent connections is very realistic, if anything it may not be enough, however we though give the size and the connections this was a good benchmark.

After running the tests through a out of the box 2003 Server running IIS 6.0 and SQL 2005 we posted a time of 3h:37min:59sec
then we ran the Server 2008 test again out of the box IIS7 and SQL 2005 and we posted a time of
0h:13min:55sec

JAW DROPPING isn’t it, yes we ran the exact same tests, we had them configured the same, both out of the box with IIS installed as an additional component and installed .NET 2.0 on both machines nothing different.

This worked out to be an amazing 17 times faster…

The test machine was the same the only difference was the drive, as one was loaded with 08 and the other with 03, however both of the drives were the same spec and same manufacture and even same model…

Machine Specs
Intel Core2 Dual core 2.12 GHz, 2GB RAM, 160GB Seagate SATA drive, Gigabit LAN

Testing (Linux) machine: Intel P4 3.0 GHz, 1GB RAM, 80GB Seagate SATA drive, Gigabit LAN

 

However during these tests we could see for 2003 Server the bottleneck appeared to be the CPU as it was using everything it could get, so we thought ok let try something bigger.

New Machine Specs
Intel Core Quad core 2.4 GHz, 4GB RAM, 160GB Seagate SATA drive, Gigabit LAN

Testing (Linux) machine: Intel P4 3.0 GHz, 1GB RAM, 80GB Seagate SATA drive, Gigabit LAN

 

Now that we had something bigger and better to test on, we thought ok lets compare something that is a little bit smaller in size, to speed the process up and also see what happens in terms of speeds.

So we deployed a Vanilla Community Manager site, which reduced the WGET to a small, manageable 70kb size. The results are still astonishing:

Win2k3
Start:        17:24:52
Finish:         18:15:53
Total time:    0:51min:01Sec

Win2k8
Start:        12:09:51
Finish:        12:22:23
Total time:    0:12min:3Sec

2008 is still 4 times faster with something tiny and very manageable. There were no bottlenecks here are all, the CPU for 2003 was not varying between 70 and 80%. The memory was very, very much under utilized, it seemed to only use a lousy 350MB, when it had gigs to use.

 

Where as Server 2008, made much better use of the memory and left more CPU, See below for the stats yourself.

performance

This shows that the SQLSVR is taking little resources, there is obviously not much for it to do there, are really no transactions of it to think about.

SQL

The W3WP exe as you can see is using alot more resources, rightful so, but as you can see its using alot of memory, which isn’t a bad thing, considering it has so much (memory is cheaper then processing power)

w3wp

Here is how the network card was reacting to the masses of connections.

network

And here is the overview of all performance, as you can see the disk was getting a work out, but dosnt seem to be a bottle neck either.

resourse over

To conclude… change all your servers to 2008, I know I cant wait to start implementing a few more 2008 Servers across our network at work.


Feb 18 2008

AD Based Outlook Email Signature for 2003 and 2007

There is a few of these scripts out there that pull all the information from AD and then input it to a simple text format. But lets face it who has just text based signatures these days with the quick connections and cheap data costs. So I went on the look out for a Email signature that could be modified to how I desire, or how the company desires. Funnily enough there was not that many scripts I could find, there does seem to be a few third party applications. But who wants to pay… I hate paying for something that can be scripted.

Anyway I came across a script that did exactly want I wanted, it removes the old signatures and creates a new one (which you have designed) making it the default signature.

http://cwashington.netreach.net/depo/view.asp?Index=1123 written by Peter Aarts

So I took the base of the script (thanks a million Peter Aarts) then modified the ‘objfile.write’ objects with the HTML parts that I required to make the  signature conform to the company standard.

It worked perfectly. But the issue is the above link / script only works with outlook 2003. the fix for 2007 is super simple…

All that needs to be done to make it 2007 compliant is:
Where it says
“HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General”
change the 11.0 to a 12.0
“HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General”

That’s it so simple….

Well its not that easy… if you have a mixed environment like we do then its defiantly not that easy… I have done the hard work for you, all you have to do is a copy and paste… and take the credit :)

'====================
'
' VBScript: <Signatures.vbs>
' AUTHOR: Peter Aarts
' Contact Info: peter.aarts@l1.nl
' Version 2.04
' Date: January 20, 2006
' Moddified By Brad Marsh Now works with both 2003 and 2007 outlook 
' Contact: gentex@tpg.com.au
' Date 19 feb 08
' Tested on Vista, XP, XP64 and office 2003 and 2007. 
' NOTE will not work that well with various email accounts
'==================== 

'Option Explicit
On Error Resume Next

Dim qQuery, objSysInfo, objuser
Dim FullName, EMail, Title, PhoneNumber, MobileNumber, FaxNumber, OfficeLocation, Department
Dim web_address, FolderLocation, HTMFileString, StreetAddress, Town, State, Company
Dim ZipCode, PostOfficeBox, UserDataPath

' Read LDAP(Active Directory) information to asigns the user's info to variables.
'====================
Set objSysInfo = CreateObject("ADSystemInfo")
objSysInfo.RefreshSchemaCache
qQuery = "LDAP://" & objSysInfo.Username
Set objuser = GetObject(qQuery)

FullName = objuser.displayname
EMail = objuser.mail
Company = objuser.Company
Title = objuser.title
PhoneNumber = objuser.TelephoneNumber
FaxNumber = objuser.FaxNumber
OfficeLocation = objuser.physicalDeliveryOfficeName
StreetAddress = objuser.streetaddress
PostofficeBox = objuser.postofficebox
Department = objUser.Department
ZipCode = objuser.postalcode
Town = objuser.l
MobileNumber = objuser.TelephoneMobile
web_address = "http://www.elcom.com.au"

' This section creates the signature files names and locations.
'====================
' Corrects Outlook signature folder location. Just to make sure that
' Outlook is using the purposed folder defined with variable : FolderLocation
' Example is based on Dutch version.
' Changing this in a production enviremont might create extra work
' all employees are missing their old signatures
'====================
Dim objShell, RegKey, RegKey07, RegKeyParm
Set objShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\General"
RegKey07 = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Common\General"
RegKey07 = RegKey07 & "\Signatures"
RegKey = RegKey & "\Signatures"
objShell.RegWrite RegKey , "AD_elcom"
objShell.RegWrite RegKey07 , "AD_elcom"
UserDataPath = ObjShell.ExpandEnvironmentStrings("%appdata%")
FolderLocation = UserDataPath &"\Microsoft\AD_elcom\"
HTMFileString = FolderLocation & "Elcom.htm"

' This section disables the change of the signature by the user.
'====================
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\NewSignature" , "L1-Handtekening"
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\MailSettings\ReplySignature" , "L1-Handtekening"
'objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\EnableLogging" , "0", "REG_DWORD" 

' This section checks if the signature directory exits and if not creates one.
'====================
Dim objFS1
Set objFS1 = CreateObject("Scripting.FileSystemObject")
If (objFS1.FolderExists(FolderLocation)) Then
Else
Call objFS1.CreateFolder(FolderLocation)
End if

' The next section builds the signature file
'====================
Dim objFSO
Dim objFile,afile
Dim aQuote
aQuote = chr(34)

' This section builds the HTML file version
'====================
Set objFSO = CreateObject("Scripting.FileSystemObject")

' This section deletes to other signatures.
' These signatures are automaticly created by Outlook 2003.
'====================
Set AFile = objFSO.GetFile(Folderlocation&"Elcom.rtf")
aFile.Delete
Set AFile = objFSO.GetFile(Folderlocation&"Elcom.txt")
aFile.Delete

Set objFile = objFSO.CreateTextFile(HTMFileString,True)
objFile.Close
Set objFile = objFSO.OpenTextFile(HTMFileString, 2)

objfile.write "<!DOCTYPE HTML PUBLIC " & aQuote & "-//W3C//DTD HTML 4.0 Transitional//EN" & aQuote & ">" & vbCrLf
objfile.write "<HTML><HEAD><TITLE>Microsoft Office Outlook Signature</TITLE>" & vbCrLf
objfile.write "<META http-equiv=Content-Type content=" & aQuote & "text/html; charset=windows-1252" & aQuote & ">" & vbCrLf
objfile.write "<META content=" & aQuote & "MSHTML 6.00.3790.186" & aQuote & " name=GENERATOR></HEAD>" & vbCrLf
objfile.write "<body>" & vbCrLf
objfile.write "<font color=696969 face=" & aQuote & "Arial" & aQuote & "><h6> "& FullName & " | " & title & " | "& Company & " | Australian Technology Park <br>"& vbCrLf
objfile.write "T +612 " & PhoneNumber & " | F +612 9209 4423 | <a href=http://www.elcom.com.au><font color=#696969>www.elcom.com.au</font></a> |<a href=mailto:" & Email &" > <font color=#696969>" & Email &" " & vbCrLf
objfile.write "</h6></font></a></B>" & vbCrLf
objfile.write "</font>" & vbCrLf
objfile.write "<font color=696969 face=arial><A href=http://www.elcom.com.au/> <img src=http://www.elcom.com.au/images/elcom-logo-web-175x70.gif border=0></a>" & vbCrLf
objfile.write "<br>" & vbCrLf
objfile.write "<img src=http://www.elcom.com.au/images/mspartner.jpg>" & vbCrLf
objfile.write "<br>" & vbCrLf
objfile.write "</font><font color=696969 size=1 face=arial><br>" & vbCrLf
objfile.write "<hr size=1 align=left width=465 color=696969>" & vbCrLf
objfile.write " This email is intended for the intended recipients(s) and may contain confidential information. <br> Reproduction, dissemination or distribution of this message is prohibited unless authorised by the sender.<br> If you are not the intended recipient, please notify the sender immediately and you must not read,<br> keep, use, disclose, copy or distribute this email without the sender's prior permission.<br> The views expressed by the sender are not necessarily those of Elcom Technology Pty Ltd</font>"  & vbCrLf
objfile.write "</FONT></BODY></HTML>" & vbCrLf
objFile.Close
' ===========================
' This section readsout the current Outlook profile and then sets the name of the default Signature
' ===========================
' Use this version to set all accounts
' in the default mail profile
' to use a previously created signature 

Call SetDefaultSignature("Elcom","")

' Use this version (and comment the other) to
' modify a named profile.
'Call SetDefaultSignature _
' ("Signature Name", "Profile Name") 

Sub SetDefaultSignature(strSigName, strProfile)
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."

If Not IsOutlookRunning Then
Set objreg = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows NT\" & _
"CurrentVersion\Windows " & _
"Messaging Subsystem\Profiles\"
' get default profile name if none specified
If strProfile = "" Then
objreg.GetStringValue HKEY_CURRENT_USER, _
strKeyPath, "DefaultProfile", strProfile
End If
' build array from signature name
myArray = StringToByteArray(strSigName, True)
strKeyPath = strKeyPath & strProfile & _
"\9375CFF0413111d3B88A00104B2A6676"
objreg.EnumKey HKEY_CURRENT_USER, strKeyPath, _
arrProfileKeys
For Each subkey In arrProfileKeys
strsubkeypath = strKeyPath & "\" & subkey
objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, "New Signature", myArray
objreg.SetBinaryValue HKEY_CURRENT_USER, _
strsubkeypath, "Reply-Forward Signature", myArray
Next
Else
strMsg = "Please shut down Outlook before " & _
"running this script."
MsgBox strMsg, vbExclamation, "SetDefaultSignature"
End If
End Sub

Function IsOutlookRunning()
strComputer = "."
strQuery = "Select * from Win32_Process " & _
"Where Name = 'Outlook.exe'"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery(strQuery)
For Each objProcess In colProcesses
If UCase(objProcess.Name) = "OUTLOOK.EXE" Then
IsOutlookRunning = True
Else
IsOutlookRunning = False
End If
Next
End Function

Public Function StringToByteArray _
(Data, NeedNullTerminator)
Dim strAll
strAll = StringToHex4(Data)
If NeedNullTerminator Then
strAll = strAll & "0000"
End If
intLen = Len(strAll) \ 2
ReDim arr(intLen - 1)
For i = 1 To Len(strAll) \ 2
arr(i - 1) = CByte _
("&H" & Mid(strAll, (2 * i) - 1, 2))
Next
StringToByteArray = arr
End Function

Public Function StringToHex4(Data)
' Input: normal text
' Output: four-character string for each character,
' e.g. "3204" for lower-case Russian B,
' "6500" for ASCII e
' Output: correct characters
' needs to reverse order of bytes from 0432
Dim strAll
For i = 1 To Len(Data)
' get the four-character hex for each character
strChar = Mid(Data, i, 1)
strTemp = Right("00" & Hex(AscW(strChar)), 4)
strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2)
Next
StringToHex4 = strAll

End Function

Enjoy

 

NOTE: I have now posted a how to implement article on this topic find it here

http://bradmarsh.wordpress.com/2008/05/14/ad-based-outlook-email-signature-for-2003-and-2007-continued/


Feb 14 2008

Windows Mobile 7 coming in 2009

Unfortunately there is no official release date at this point in time, It was first set for release in mid 2008, however this was pushed back for a 2009 release. From various sources they are indicating early 09.

Recently screen shots of the WM7 may look like were leaked, I found a great article showing a great deal of screen shots also outline features and the focal points of what WM7 is all about, and not surprisingly its touch and motion… Obviously this is Microsoft’s response the I-Phone.

Article can be found here

I have played with an I-phone previously and I did like the cosmetics and the motion effects it has, however I believe WM7 will be a much stronger OS, it has the stability of years of development behind it, its a much, much more mature product.

I am anxiously waiting for this release or even the beta of WM7


Feb 7 2008

SQL 2008 Reporting Functionality

No I am not talking about reporting services I am talking about the database reporting functionality.

There is a built in reporting function, which can be accessed from the database level, by simply right clicking the database you wish to view reporting on.

reporting

As you can see there are some very useful pre-defined reports, my particular favorite is the ‘Disk Usage By Table’ Only very recently I had to run a query against all tables in a database to find out the disk usage for the tables…. Now you don’t have to write such query’s like:

-- first we need to find the tables
-- using master to query 
-- remember to change databasename
select *
from databasename.information_schema.tables

This above query will retrieve the ‘Table_Catalog’, ‘Table_Schema’, Table_Name’ and ‘Table_Type’

Whilst we don’t need anything apart from the table_name, it’s always handy to have everything, but for this exercise we only want the table_name so copy the contents of the ‘table_name’ dump it into excel, make sure you put it in row B not A, because we need to leave some space for the next query

Place the below query (not the comments just the exec sp_spaceused) into the A row of Excel.

-- here we are calling the stored procedure 'spacedused'
exec sp_spaceused

The fill all the rows down with the above query like:

reporting01

Once you have completed this then you save the file as a .CSV, once you have completed this open notepad and then open the CSV within notepad.

Your notepad file will look similar to:

image

As you can see the query and the table name are separated by a comma, we need to get rid of this, press ctrl + H, this should bring up the find and replace function now in the find type ’spaceused,’ in the replace enter ’spacedused ‘ (note there is a space the comma is now deleted in the replace field)

image

Once you have got this right then, click on ‘Replace All’.
it should now look like:

image

now you are ready to go and paste all of the notepad file in to a SQL query against the database you wish to find the table size data on.

This is what is should look like when it has turned the results

image

If you have more then 100 tables you will have to view the results as text.

As you can see that’s a pretty long winded process, now I know there are some scripts out there that can and will do the same thing, and there are other methods out there, but I find this works well.

To cut a long story short, you no longer need to go through this dubious process any more you simply click on ‘Disk Usage by Table’ simple and it shows you a nicely formatted report, Like:

image

SQL 2008 also has the ability for you to create your own reports through a easy to use report builder not the old one in SQL 2005 but an actual desktop application called  ‘Microsoft Report Designer’, which is also a new feature in itself.


Feb 6 2008

Windows Server 2008 is NOW RTM

As of last night at 8:10pm MSDN released the RTM versions of Server2008 Enterprise edition and Standard edition.

Both x64 and x86 were released. We are downloading it now as we speak (type), As soon as we get a chance we will be upgrading our RC0 and RC1 Servers to the real thing.


Feb 4 2008

Turning on SQL08 Database Encryption, Putting it to the test

So first of all you need to create your database if you haven’t already, then open ‘query’ on the ‘master’ database.

This is very important make sure you have the master database and not the user database. (of course I could have put ‘use Master’ but I am outlining this so you know and are learning :)   )

-- create a Database MasterKey

create master key encryption by password = 'password here';

go

Encryption

-- Create a certificate to a database

Create certificate testingCert with subject = 'Testing Certinifcate for SQL'

go


Encryption02

Now for this part you need to ‘use databasename’ then paste the below Script, or of course just use the query on the database and then copy and paste

– creates the key for the database selected
– below I have used AES_128 this is more then enough but there are others
– such as:
– aes_192, aes-256 and tripleDes
create database encryption key with algorithm =AES_128
– notice I am using the cert name I have just created
encryption by server certificate testingcert
go
– use the database you are applying the encryption to:
alter databasename testing
set encryption on
go

Encryption03

You can now test to ensure that the encyption has been applied by simply going to the GUI.

This is found at the database level, in tasks toward the bottom.

Encryption04

Now for the testing of the data.

To show what small overhead is used, personally I see it is little to none.

Here is what was used and added to both databases (got this from http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=671045&SiteID=1 slightly modded)

create tableemployeesdemo
(
recordno int identity(1,1),
employeeno varchar(20),
lastname varchar(50),
firstname varchar(50),
middlename varchar(50)
)

insertemployeesdemo
(employeeno,lastname,firstname,middlename)
values(‘emp000′,‘green’,‘kat’,‘blue’)
declare @CTR INT
declare@ctrstr varchar(7)
select @ctr=0
WHILE @CTR<100
BEGIN
select
@ctr=@ctr+1
select@ctrstr=Str(@ctr
)
insertemployeesdemo(employeeno,lastname,firstname,middlename)
values(‘empno’+@ctrstr,‘lname’+@ctrstr,‘fname’+@ctrstr,‘mname’+@ctrstr)
end
 

Encryption05 


This is applying the above script to the non encrypted database

Encryption06

this is applying the same script to the ENCYRPED database and the below images are what you should see once the above query has completed.


Encryption07_not

Encryption08

They both have the same table and same amount of rows.

Now its time to backup the databases, I am not going to tell you how you do that I am hoping you can do that one  Now this is what I get in terms of file sizes

Encryption09

As you can see there is little difference, obviously the difference may grow a little with a bigger database, which is something I am yet to try and will shortly :) , but I am doubting the file size will be all that different, from the original backup file.

So here is the results, first the NON-Encrypted

Encryption10

As you can see I do a find for green, which is something found in the table we created

Now this is the encrypted one

Encryption11

and look at that, no green found…

Conclusion it works, and it works well with little overhead of disk space, as for time frames well it’s hard to tell with such a small databases maybe with a bigger one it might be easier to judge. But this is looking promising.

Being that Elcom is on one of our SQL 2008 servers I am going to be applying this to the production database.

We love security.


Feb 4 2008

Some of new SQL 2008 fetaures

I recently attended the  of which MVP Craig Bailey runs on a regular basis. Peter Ward was kind enough to present us with some real life demos of some of the awesome new features Whilst Peter did mention a stack of them, I must say I am very impressed with some of them.

In particular the transparent data encryption. What is it? simple really. Microsoft now offers SQL backups which can now be encrypted, with NO overheads, that’s right no overheads, it doesn’t seem to take any more time to do this, it take exactly the same space as the non-encrypted backup, and restore times also appear to be the same.

 How does it work,  Well within the CTP it is currently activated via T-SQL scripting, i would suggest going hereto have a look at what SQL scripting is required.  I am sure at release time there will be some GUI associates with the TDE. Now lets say that the hard drives were stolen and this feature were enabled, it would be almost impossible to get the data and extract it out from the encrypted backups, why well once 2008 SQL is installed, it is also installed with a certificate, but this cert is made up of all your hardware components details. So this meaning that there is only 1 of every cert ever created. But then your about to ask how do you move a backup from one SQL server to the other, well apparently ( i have not tried this for-myself, I will be doing so when I get a free second, and will blog again so stay posted) you can move the Cert over with a password that is assigned to the backup.

I will will be blogging more about this feature with some screen shots shortly, stay posted :)

Another feature that we all wanted years ago was Intellisense, yes its now finally here in SQL 2008 server. THANKYOU

One last feature that I really am liking the sounds of is the Resource Governor however more on that to follow soon, i will have some real life examples shortly.