Sql-server – Running SQL Server on the Web Server

optimizationsql-serverwebserver

Is it good, bad, or indifferent to run SQL Server on your webserver?

I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.

Best Solution

For small sites, it doesn't make a bit of a difference. As the load grows, though, this scales really badly, and quicker than you think:

  • Database servers are built on the premise they "own" the server. They trade memory for speed and they easily use all available RAM for internal caching.
  • Once resources start to be scarce, profiling becomes very difficult -- it is clear that IIS and SQL are both suffering, less clear where the bottleneck is. IIS needs CPU, SQL Server needs RAM or CPU etc etc
  • No matter how many layers you put in your code, it all runs on the same CPU, therefore a single layered application will run better in this context -- less overhead -- but it will not scale.
  • Security is really bad, usually you isolate SQL behind a firewall!

If you can afford it, it's probably better to shell out a few bucks and get a second server, maybe using PostgreSQL. One IIS server and one PostgreSQL cost about as much as on IIS + SQL Server because of licensing costs...