ASP.NET Cafe
new tricks every week

MS SQL 2005 Performance tip: Turn off autoclose for your databases

Wednesday, 25 November 2009 08:40 by dmitriy
MS SQL 2005

For some reason by default you can have "AUTOCLOSE" property of your database set to ON. That's not bad, but if you check your server Event Log you can find a lot of entries like "Starting database 'xxxxxxx' ". And log is not a problem, but for sure this takes a time and slow down your asp.net application response.

You can turn it off in Managment Studio.
or you can run a little sql to update all databases on server:

EXECUTE sp_MSforeachdb
'
IF (''?'' NOT IN (''master'', ''tempdb'', ''msdb'', ''model''))
   EXECUTE (''ALTER DATABASE [?] SET AUTO_CLOSE OFF WITH NO_WAIT'')
'

All databases won't close automatically and response instantly.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , ,
Categories:   SQL | SQL
Actions: E-mail | del.icio.us | Kick it! | DZone it! | Permalink | Comments (3) | Comment RSSRSS comment feed

How to Speed up aspnet_compiler

Monday, 16 November 2009 21:49 by dmitriy

Here is one trick to greatly speedup asp.net compiler. First of all, assume you have enough RAM to give about 512Mb for this. RAM is cheap, so you always can visit store and buy it. And your time is priceless. 

Idea is in creating RAM drive and pointing asp.net compiler temp there. To create RAM drive you need to download following free software

http://www.ltr-data.se/opencode.html#ImDisk

IMDisk - awesome thing. Install it.

Now create ramdrive.cmd somewhere ( for example c:\ramdrive.cmd ) with following content

imdisk -a -s 512Mb -m R: -p "/fs:ntfs /q /y"  

create a shortcut and add it to Startup

Now everytime you start PC you'll see quick console window and you'll got a new drive "R"

Ok. Now you need to change your temp settings

Edit this file: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config  

( I assume that you've Windows installed in C:\Windows . Change path if it's different )

 In this file you need to add attribute to <compilation> tag

After change it should look like this: 

        <compilation tempDirectory="r:/asp.net_temp" > 

That's all. Now you can build your asp.net projects much faster. You can try to point all windows Temp on that RAM drive, but I haven't gone this far yet. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   ASP.NET | Main
Actions: E-mail | del.icio.us | Kick it! | DZone it! | Permalink | Comments (1) | Comment RSSRSS comment feed