Scott Hanselman

The Myth, The Legend, the Interop - Using the .NET Framework SDK Interoperability Tools

February 24, 2004 Comment on this post [0] Posted in Programming | Tools
Sponsored By

Sam Gentile's second COM Interop article on "Using the .NET Framework SDK Interoperability Tools" is up on MSDN!

Kudos to Sam for another well written and easy to read (while the subject is complex) article.  Now I have yet another place to point folks for Interop Zen.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Scott Hanselman's .NET Rocks show is up and ready for download!

February 23, 2004 Comment on this post [0] Posted in ASP.NET
Sponsored By

My .NET Rocks show (that was Live last week) is available for download.  Carl and Rory banter for a while, and I show up at about 0:22 minutes in and for the rest of the show.

Also, check out Peter Blum at about 0:55, he talks about his line of products that I wholly recommend!

Definitely a show worth iPod'ing or burning to a CD.  Also, it'll be up on MSDN probably tomorrow.

Thanks to Rory and Carl and all their Audio folks for making their 2nd Live show, while a little dodgy during the live streaming broadcast, a total BLAST to be on.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Here's a great list of tips on Optimzing Performance with Virtual PC (VPC)

February 20, 2004 Comment on this post [6] Posted in Programming
Sponsored By

Here's a great list of tips from my buddy J. Sawyer at MSFT.

Biggest perf tip is to put the VPC Virtual Hard Disks (VHD) to separate disk spindles from the operating system.  The biggest perf issue with VPC is related to disk I/O … and by making the VPC fight with your OS and swap disk make this issue much, much worse.  Additionally, today’s USB 2.0 and Firewire external hard drives run on a fast interface bus (Firewire does have some advantages over USB 2.0, but both are excellent), have a large (8MB) buffer and spin at 7200 RPM, as opposed to 4200 RPM for most laptop HDD. 

Also, note the tip below regarding “Run Virtual PC at Maximum Speed” … this will give a boost to the VPC’s thread priorities at the expense of the host OS applications.  Depending on what you are using the VPC for, this may be exactly what you want. 

From a PPT Deck:

Guidelines:

  • Ideally Virtual PC performance is at:
  • CPU: 96-97% of host
  • Network: 70-90% of host
  • Disk: 40-70% of host
    • However this is only for optimized guest operating systems running typical loads for a single process
    • The Virtual PC team’s aim is always to provide the fastest possible solution while not compromising compatibility
    • While virtual machines are not slow – there is always the potential for an unusual application to cause performance issues

Performance Tuning

  • Guest Performance – Preferences
  • Check “File … Options”
  • Running guest in background: Enable “Run Virtual PC at Maximum Speed”
  • Running a test on multiple guests: Enable “All running virtual machines get equal CPU time”
  • Memory
  • Host should have a minimum of 256MB, 512MB – 1024MB recommended
  • More memory is recommended for running multiple virtual machines simultaneously
  • Each guest should be allocated memory like it would on a physical machine
  • Virtual machines cannot use paged memory on the host system

Additional Disk Optimizations

  • Virtual Hard Disk size
  • Compress them
  • Defrag guest
  • Clear unused sectors ( Cipher, Eraser, etc.)
  • DO NOT attempt this step on a differencing drive – it will expand the disk to maximum size and you cannot compact it.
  • Compact using Virtual Disk Wizard
  • Enable NTFS compression on host operating system
  • Trades off performance for file size
  • Virtual Hard Disk performance
  • Place the .VHD files on separate spindle from host OS
  • If using Undo or Differencing Disks, place them on an additional spindle

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Scott Hanselman (that's me) on .NET Rocks! Live! Friday 9am PST over Windows Media and Skype.

February 19, 2004 Comment on this post [3] Posted in ASP.NET | DevDays | Web Services | XML
Sponsored By

Tomorrow (assuming I get up) I'll be on .NET Rocks Live! with Carl Franklin and Rory Blyth.  It's like Howard Stern, but with code, and it doesn't suck.

We're going to chat about all sorts of fun stuff. ASP.NET, XML, Web Services, Perf Counters, DevDays, etc.

Please do check it out.  If you're on the East Coast, listen to us at 12pm EST as if we were your lunch time radio show (the .NET Gang, those wacky pundits :) ), and if you're on the West Coast listen to us at 9am PST and pretend we're the .NET Morning Zoo!

If you'd like, check out my first .NET Rocks show, it's archived!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Performance Counters in ASP.NET

February 18, 2004 Comment on this post [2] Posted in ASP.NET
Sponsored By

Did some great performance testing this last Sunday on the bank we're taking live soon.  We needed to get a few thousand users on the box, all banking at the same time.  The Host Interface side has some great performance counters that made it very easy to measure.  Even though they have a rich serious of counters, I added some counters to the UI side. 

As I've mentioned before, we describe our Domain Objects and Messages with XSD, and generate loads of C# code with CodeSmith (and some with XSLT).  Using these 'nouns' we create services (verbs) that act on them as they move through the system.  We build 1st class interfaces on top of a 3rd class router that basically does an Invoke/Execute/DoIt/IDispatch...a lot the way Invoke() works with ASMX WebServices. 

There's a whole vocabulary of messages that can be sent to Voyager, like 'GetAccounts' or 'AddPayment.'  Some come with Voyager and some are added for the implementation. 

Typically with Performance Counters there are either static counters, like 'Avg Bytes/sec' through the system, or instance counters like 'Bytes/sec on this hard drive.'  Often these instance counters are per process, or per piece-of-hardware. 

But since the verbs that head through the system can be dynamic, why not make new per counters as we see new verbs? (there's usually no more than 100, really usually <50)  So, on both the UI and HI we can look at instance Performance Counters like 'Time in (ms) for GetAccounts' or 'Bytes Out for AddPayee.' 

By adding the same counters but for an 'instance' that is really a verb, we can find out when a certain operation (verb) is not performing well on the system. 

And, since we can look at what the UI's round-trip time is (for example, 500ms) and what the HI's times are (200ms to the host, 150ms in the code) we can start measuring interstitial times like marshalling time, logging overhead, etc. at a very granular level.

Fortunately we baked in hooks to allow Performance Counters early on in the project.  You should to!  It's nice to REALLY know what's happening in your app.  The less of a black box your own app feels like, the more confident you can be when you make Service Level Agreements and predictions as to performance.  Nothing is more scary than NOT knowing how to measure your own application.

Tips and Best Practices:

  • Remember the ASPNET process has access to WRITE to Performance Counters, but not READ, CREATE, or DELETE counters.
  • Add an Installer class to your ASP.NET application that does the creating of the PerformanceCategory, the creation of the PerformanceCounters and the deletion at uninstall.  You can run 'installutil [/u] yourclass.dll' from the command-line.  You can also add your installer dll to the Custom Actions section of your Web Setup and the Performance Counters will get created/deleted automatically when your MSI runs.
  • Use some High Performance Timer for your timing - don't use DateTime.anything.

It was a good weekend.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.