.Net Performance Testing and Optimisation – Free eBook
Saturday, January 30, 2010 11:43 AM

This blog has been super quiet lately. This is mainly because I have been hard at work writing a book around .Net Performance Testing and optimisation. Well, I am happy to say that part 1 of this book is available as a free download from here.

The full book will follow shortly and will contain concrete examples of popular performance issues in .Net applications, what to watch out for, and how to mitigate them. Additionally, you’ll get performance tips for Internet Information Server, web apps, SQL, caching strategies and a whole lot more.

In part 1, you will learn how to setup a performance test rig, how it works, how to record tests, replay them, what metrics to collect, and how to analyse them.

In addition, you will find out how to automate all this. Finally, you will get insight into profiling an application to improve performance. This is the one stop shop for performance testing and optimisation on the .Net platform.

Since its free, download it now!

iPhone Apps using Microsoft .NET
Wednesday, December 02, 2009 8:22 AM

My good friend Wally McClure has written a short eBook on “Building iPhone and iPod touch Applications for the .NET/C# Developer with MonoTouch”.

You can check it out here

Given that iPhone is a very popular phone and that some of the development barrier for Microsofties like me is no .Net language support (Objective-C being the native development language), this can now be overcome with the help of Wally’s eBook.

Its small and concise with topics covering class library support, deployment and debugging. I encourage you to check it out.

Sydney Architecture User Group – Next Meeting: Why Windows Azure is not just Generic Brand Web Hosting
Tuesday, November 10, 2009 2:46 PM

The Sydney Architecture User Group is having its second meeting this month on Thursday, 26th November. Full details can be found on our new (but very simple) website located here ( http://thesaug.org ). You can subscribe to the monthly email and also indicate your intention to come by selecting the RSVP option (which would be really nice if you did :-) )

Here is what the next Sydney Architecture meeting has in store. Hope to see you there.

Why Windows Azure is not just Generic Brand Web Hosting

Presenter Nick Randolph
Date/Time: Thursday 26/11/2009 06:00 PM
Where: Grace Hotel , Function Room 77 York st Sydney,NSW. 2000

Abstract

If you take only a glimpse at the offerings on the Windows Azure platform it may just appear to be a form of generic/home brand web hosting from Microsoft. However you’d be sorely mistaken as the platform is significantly different from not only traditional web hosting offerings but also from its competitors in the cloud computing space. In this session we will cover the unique offerings of cloud computing before looking at each of the components of the Windows Azure platform. Cloud computing is new, hot and sexy, but does that mean it’s right for you? Make sure you’re ready to interact and discuss the relative merits of building on the cloud.

Presenter Bio

Nick currently runs Built To Roam (http://www.builttoroam.com) which focuses on building rich mobile applications. Previously Nick was co-founder and Development Manager for nsquared solutions where he lead a team of developers to build inspirational software using next wave technology. Prior to nsquared, Nick was the lead developer at Intilecta Corporation where he was integrally involved in designing and building their application framework.

Sample chapter from upcoming book
Sunday, November 08, 2009 6:59 PM

There is a sample chapter from my upcoming book on all things performance related within the Microsoft platform. Specifically, the book will be about performance testing, profiling and optimisation for web and desktop applications developed using Microsoft.NET.

This sample chapter is just a teaser and the book itself goes into great detail about how to setup a performance test rig using Visual Studio, how to record, manage and analyse performance metrics, and what you can change to make your apps fly.

Anyways, the sample chapter is located here.

( http://www.simple-talk.com/dotnet/performance/understanding-performance-profiling-targets/ )

Hope you like it.

SAUG – Sydney Architecture User Group
Thursday, October 15, 2009 9:28 AM

The first meeting of the Sydney Architecture User Group is going to be held on Thursday, October 22nd, 2009, form 6.00pm to 8.00pm, at the Grace Hotel, 77 York st, Sydney. (Link to map) It will be housed in one of the very nice function rooms they have. Food and drink will be provided. Omar Besiso and myself will be hosting the event, with all funding and sponsorship graciously provided by our company Datacom.

We intend on having a proper site to provide RSS feeds, email subscription and the like, but until we get better organised, we have a facebook page at : http://www.facebook.com/event.php?eid=173036810551 or you can contact myself directly on paul.glavich AT datacom.com.au or you can contact Omar on omar.besiso AT datacom.com.au

Note: If you do intend on coming along, it would be appreciated if you could RSVP via our facebook page, or contact me directly at paul.glavich AT datacom.com.au so we can order to right amounts of food

The goal of the group will obviously be to discuss architecture related matters, but we are going to try and obtain a diverse range of speakers to cover all aspects of architecture. From application architecture, infrastructure, process, and although I am a Microsoft advocate, there is no intent to solely focus on Microsoft related technologies. We will try and cover the whole landscape of enterprise and solution architecture from a variety of angles.

Our first meeting will be a little introduction to the group itself, and then straight onto a presentation by Richard Banks. Details below:

Title:  Architecture in the Small

No matter how good your design or how well the big pieces of your architecture fit together it's the little things that really count.  The little things are the things that can take your vision of beauty and either make it a reality or turn it into a thing of nightmares. Richard will talk about what these little things are, the impact they have and, most importantly, what to do about them.

Bio: Richard Banks is a Principal Consultant with Readify, with a history that includes building ERP, HR, point of sale and student administration systems as well as being the CIO/CTO for a listed company.  He is a Certified Scrum Practitioner, runs the Sydney and Virtual Alt.Net user groups and has spoken at both Tech.Ed and a number of other user groups around the state.  His blog can be found at http://richardsbraindump.blogspot.com

Further meetings will see a format of a short half hour presentation, followed by a longer presentation typically of an hour. We have some interesting speakers lined up for future meetings and if you are interested in presenting at the group, I would love to hear from you.

We look forward to seeing you there!

ASP.NET v4 Presentation Deck and Demo’s
Friday, October 02, 2009 1:13 PM

My ASP.NET v4 New Features overview presentation that I delivered at Sydney Deep .Net User Group (http://sdnug.org ) is available for download here (http://sdnug.org/presentations/200910.zip).

Note: If the above link returns a 404 error, please try here instead.

It covers almost every single new feature that will be covered in ASP.NET v4 in the next release With some demo’s showing off the permanent redirect feature, a bunch of templating demo’s, new client ID functionality and the new chart control.

Hope you enjoy it.

2 TechEd Interviews are live
Friday, September 11, 2009 3:45 PM

Its been a long time since I wrote a blog post but I have been a very busy boy.

This week I have been at TechEd Australia on the sunny Gold Coast in Queensland. I have been keeping a pretty low profile this year but I did participate in 2 interviews that are now available for viewing or download from the Microsoft online site.

The first one is an interview with Omar Besiso, friend, colleague and Enterprise Architect at Datacom on the topic of Building Enterprise Software. You can grab it from here.

The second is an interview with Damian Edwards and Tatham Oddie on the topic of ASP.NET WebForms vs ASP.NET MVC framework. You can access it here.

Hopefully you find them valuable, or at the very least, somewhat entertaining.

Silverlight 3 and WCF Faults
Tuesday, July 14, 2009 3:57 PM

On  a previous project that utilised WCF and Silverlight 2, I began implementing an error handling strategy that was going to rely on certain FaultExceptions being propagated to the Silverlight client. Well it turned out that Silverlight 2 does not support FaultExceptions so that was not going to fly and a custom solution was built.

Well Silverlight 3 does change this to some degree. Silverlight 3 now supports to the notion of Fault Contracts and FaultExceptions. In your Silverlight client code, if I have a WCF service called ThrowExceptionMethod (which as you may have guessed throws a FaultException) you can do something like this:

First wire up the service call:

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    TestRef.TestServiceClient client = new TestSilverlightApplication3.TestRef.TestServiceClient();
    client.ThrowExceptionMethodCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(client_ThrowExceptionMethodCompleted);
    client.ThrowExceptionMethodAsync();
}

Then handle any error situation in the completed event:

void client_ThrowExceptionMethodCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
    if (e.Error == null)
        MessageBox.Show("Call sucessfull");
    else
    {
        string msg;
        FaultException<ExceptionDetail> fex = e.Error as FaultException<ExceptionDetail>;
        if (fex != null)
            msg = string.Format("Fault Exception recevied. Reason: {0}, Message: {1}", fex.Reason, e.Error.Message);
        else
            msg = string.Format("Error recevied of type: {0}, Message: {1}",e.Error.GetType(),e.Error.Message);
        MessageBox.Show(msg);
    }
}

Here you can see that we test the ‘e.Error’ property to see if its an exception of type FaultException, otherwise the error will flow through generally as a CommunicationException as per normal WCF behaviour.

That all sounds easy, however you still need to tell the WCF service (or more specifically WCF itself) to return the fault using a HTTP status code of 200 (OK) instead of a HTTP status code of 500 (server error) which is the default. If you don’t do this, then the error will always come through as a CommunicationException .

You need a little bit of code and configuration for this. First you need to define a custom behaviour like so:

public class SilverlightFaultBehavior : BehaviorExtensionElement, IEndpointBehavior
    {        
        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            SilverlightFaultMessageInspector inspector = new SilverlightFaultMessageInspector();
            endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
        }

        public class SilverlightFaultMessageInspector : IDispatchMessageInspector
        {
            public void BeforeSendReply(ref Message reply, object correlationState)
            {
                if (reply.IsFault)
                {
                    HttpResponseMessageProperty property = new HttpResponseMessageProperty();

                    // Here the response code is changed to 200.
                    property.StatusCode = System.Net.HttpStatusCode.OK;
                    reply.Properties[HttpResponseMessageProperty.Name] = property;
                }
            }
            
            public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
            {
                // Do nothing to the incoming message.
                return null;
            }
        }

        // The following methods are stubs and not relevant. 
        public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
        {
        }
        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
        }
        public void Validate(ServiceEndpoint endpoint)
        {
        }
        public override System.Type BehaviorType
        {
            get { return typeof(SilverlightFaultBehavior); }
        }
        protected override object CreateBehavior()
        {
            return new SilverlightFaultBehavior();
        }
    }

Then some config:

<system.serviceModel>
    <extensions>
      <behaviorExtensions>
        <add name=”silverlightFaults” 
             type=”Microsoft.Silverlight.Samples.SilverlightFaultBehavior, 
             SilverlightFaultBehavior, 
             Version=1.0.0.0, 
             Culture=neutral, 
             PublicKeyToken=null/>
      </behaviorExtensions>
    </extensions>
    <behaviors>
        <endpointBehaviors>
          <behavior name=”SilverlightFaultBehavior”>
            <silverlightFaults/>
          </behavior>
        </endpointBehaviors>
    </behaviors>
    <services>
        <service name=”Calculator.Web.Service”>
            <endpoint address=”” 
                      binding=”basicHttpBinding” 
                      contract=”Calculator.Web.Service” 
                      behaviorConfiguration=”SilverlightFaultBehavior” />
</service>
  </services>
</system.serviceModel> 

So, its still not quite there yet, but its better. It would be nice if this status code behaviour were part of the default Silverlight service template and that it was a provided behaviour, rather than a roll your own custom one.

Note: The custom behaviour, as well as more information on this subject, can and was taken from this article here.

Getting better performance in web apps with a few lines of script
Saturday, June 27, 2009 8:53 PM

We had a situation where a web application was utilising near 100% of CPU all the time under light load and it was proving very hard to reduce this significantly through code optimisation. We were performance testing and profiling, but only seeing marginal gains.

The infrastructure that was hosting the web application was as follows:

  • Virtual Server (Hosted via VMWare Server) running Windows Server 2003 64 bit
  • .Net 3.5
  • Dual Virtual CPUs
  • 2 Gb of memory.

Now I am not a big fan of virtualisation for hosting high performance web sites but we were stuck with this. At any rate, we had consistently high CPU utilisation for seemingly no real reason. Some of the most simple requests were generating high CPU usage.

After some investigation, and also the help of a friend and very smart dude, Scott Forsyth (who works for Orcsweb a high profile web hosting company) we decided to try setting Internet Information Services to 32 bit mode to see if any difference was seen.

To cut a long story short, we changed Internet Information Services to run in 32 bit mode. This simple switch, yielded significant lower CPU utilisation and in some case, almost cut the CPU utilisation in half!

Why would this be so? Well, it turns out there are a few reasons for this. Probably the primary reason is the fact the we get less information within the level 1 cache of the processor because of the increased structure size (pointers are bigger) within 64 bit systems. The same information in a 64 bit system occupies more memory than its 32 bit counterpart, therefore we can fit less into the processor cache. More information on this can be found here.

Its really easy to change IIS to 32 bit mode. The steps are:

  1. To enable 32 bit mode on IIS in 64 bit windows, at a command prompt type:
    cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
  2. Once this is done, 32 bit mode is enabled but we need to ensure that the 32 bit DLL’s are used as IIS will still have the 64 bit DLL’s defined for the ISAPI handler. To do this, all we have to do is re-register ASP.NET. At a command prompt, simply type:
    %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe –i
  3. Finally, just make sure the status ASP.NET version 2.0.50727 (32-bit)  in the web services extension, within IIS, is set to allowed.
    (More information on this process can be found here http://support.microsoft.com/kb/894435)

And that’s it. A few lines of script, and we had effectively reduced CPU utilisation by somewhere in between 30% and 50%!

Conclusion

So my rule is this, If you are:

  • Running Windows server in 64 bit mode.
  • Running a standard .Net web application
  • Do not need a large memory address space (ie. over 4 gigabytes)
  • Have no special 64 bit optimisations

Then this change will yield immediate performance improvements in your application, and in some cases (dependent on what your application does), yield significant performance improvements.

by Glav | 9 comment(s)
Filed under: , , ,
FromTheGrey – Arts Site
Sunday, May 10, 2009 1:08 PM

Recently, I have been working on creating an arts based website called “FromTheGrey” at http://FromTheGrey.com

Its a site devoted to showcasing the pictures and artwork created by my wife Michele. Previously, Michele has been very reluctant to showcase these pieces, but I really like them, as do many others I know, so it took some time and coaxing to convince Michele to show them to the world.

However, I finally managed to do. As a result, “FromTheGrey” was born. Its a relatively simple site but I hope you like the art on the site and if so, would really appreciate you recommending it to others.

Its currently simple but functional, and will have many more pieces of work from Michele on there, as well as enhanced styling and functionality.

For now though, we would love your feedback which can be submitted via the Contact Form on the site.

For the technically inclined, it utilises ASP.NET 3.5 Webforms, jQuery 1.3.2, and jQuery plugins for the dialog box and gallery effects, Thickbox and Galleria respectively.

by Glav | with no comments
More Posts Next page »

This Blog

Syndication