Branislav Abadjimarinov's technical blog

Branislav Abadjimarinov's technical blog - For February 2010

  1. Web Applications Development with .NET Framework and ASP.NET course in Technical University of Sofia

    From Monday, 15 February a new course on programming is starting in the Technical University of Sofia. The course is titled "Web Applications Development with .NET Framework and ASP.NET" and it will cover some of the basics of Microsoft .net platform and ASP.NET. The training provided will be very brief and it will require a lot of dedication by the people attending.  I'm taking part with a couple of lectures on ASP.NET and AJAX. The course is free and is supported by Telerik Academy. You can check the course official web site for more information.

    Posted by Branislav Abadjimarinov on February 11 at 1:43 AM

  2. How to speed up compilations in ASP.NET Web Site

    When working with ASP.NET most developers, including me, choose to use the Web Site model. One of the reasons for that is the smooth working process. If you make a change in your website you do not need to manually recompile - asp.net does that for you. But because of this change there is a slight delay before the site starts again. There are several tricks to decrease this time to minimum.

    1) Use the optimize compilation option. It was introduced with a hotfix for .net 3.5 sp1. You can find it here - http://support.microsoft.com/kb/961884.
     In general on change in App_Code, web.config or Global.asax file ASP.NET wipes the temporary files and generates new. This option allows ASP.NET to generate only the changed part of the files and leave the others. The only thing you have to do to enable this behavior is to put in your web.config :
    <compilation optimizeCompilations="true">
    The fix is for Windows XP,Windows Server 2003, Windows Vista and Windows Server 2008.
    If you're running Windows 7 or Windows Server 2008 R2 you already have this feature installed but you still need to enable it.

    The first trick will take care of the redundant file generation but files still will be copied. The Second one will speed the copy and access process.

    2) Keep your ASP.NET temporary files in the RAM. There are some programs that create a RAM disk - a hard disk partition that is persisted in the RAM. I personally use RAMDisk - it is free for hard disks bellow 4GB and you can download it from this address - http://memory.dataram.com/products-and-services/software/ramdisk/download-ramdisk. The UI of the software is pretty simple - you have to choose size of disk in MB and Format.

    RAMDisk

    The options for format are FAT16, FAT32 & Unformatted. You can use Also NTFS which I will recommend. You need to choose the Unformatted option. Then you Start the RAMDisk, go to Control Panel->Administrative Tools->Computer Management and in the left pane choose Storage->Disk Management. Right-click on the unallocated space and choose New Simple Volume. You'll be prompted to choose Letter for the volume - I usually choose R (for RAMDisk).

    ComputerManagement

    Now you should be able to see the new drive in Windows Explorer.

    WindowsExplorer

    The only thing you have to do next is to change the path for your temporary ASP.NET files in web config's compiler section.
    <compilation defaultLanguage="c#" debug="true" optimizeCompilations="true" tempDirectory="R:\ASP_NET_TempFiles\" >
    On the next website request you'll see that the files will be populated on your newly created RAM disk.

    The size of the disk depends on how big your project is. I usually use no more than 512MB - a good round number :-) .

    If you want to keep the data in the virtual disk even when you shut down your PC you can persist the drive to image file (.img) from RAMDisk.

    RAMDisk second tab

     

    P.S. Have in mind that there are technologies that does put your most used files in the RAM automatically (for example Microsoft Super Fetch) but you do not have controll what does and what doesn't get cached. So just try this method and see if there are any improvements in web application start time.

    Posted by Branislav Abadjimarinov on February 02 at 11:18 AM

© Copyright 2017 Powered by AtomSite 1.3.0.0