Scott Hanselman

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

February 19, 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

Choosing the best computer for you...in 1982.

February 18, 2004 Comment on this post [10] Posted in Musings
Sponsored By

Found this little gem in the archives and scanned it for y'all.  Couple of great ads inside. 

  • An IBM PC ad, the one with Charlie Chaplin - 16k bytes.  16 bit, 8088.  optional 5.25" 160k floppy.  4-color 320x200. Good times.  Only $3k.
    "The modem that plugs into your phone takes the codes your IBM Personal Computer understands and turns them into signals that can be transmitted over phone lines"
  • Some nice articles on acoustic vs. direct-connect models. The acoustic model from Novation was only $189.
  • This was back before computing was limited to a few companies. Some highlighted models:
    • $g(Apple II)
    • $g(Atari 800)
    • $g(Commodore 64)
    • $g(Franklin ACE 1000)
    • $g(IBM PC)
    • $g(TRS 80 Model III)
    • $g(Apple III)
    • $g(Casio FX9000P)
    • $g(Corvus Concept)
    • $g(Cromemco C10)
    • $g(DEC Rainbow 100)
    • $g(Fortune 32 16)
    • $g(Heathkit H90 Zenith Z89)
    • $g(MTU130)
    • $g(NEC APC)
    • $g(North Star Advantage)
    • $g(Olivetti M20)
    • $g(TFI if800)
    • $g(Victor 9000)
    • $g(Wang PC)
    • $g(Xerox 820II)
    • $g(Dynalogic Hyperion)
    • $g(Epson HX20)
    • $g(Grid Compass)
    • $g(Kaypro II)
    • $g(Lexicon LEX31)
    • $g(Osbourne I)
    • $g(Otrona Attache)
    • $g(Panasonic RLH1000)
    • $g(Sharp PC1500)
    • $g(Atari 400)
    • $g(Commodore VIC 20)
    • $g(TI99 4A)
    • $g(Timex Sinclar 1000)
    • $g(TRS80 Color Computer)

Do you have any fond memories of these beauties?

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

Test Coverage IS important...

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

This fellow said:

"I would much rather aim for 100% test-driven development than aim for 100% test coverage."

But I fear he's missing the point.  If I'm only testing 1% of my code paths, 100% of the time, what am I accomplishing? Squat. 

As my boss has said, adding a non-intrusive code coverage tool to an already successful unit-testing strategy can absolutely find gaps in coverage that staring at the screen just won't find. 

But juxtaposing 100% TDD with a 100% coverage goal doesn't make sense.  They are complimentary, parallel even, but not opposing goals.

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.