views:

83

answers:

3

I am developing sample web application which use C#, and LINQ to SQL. The application is very very slow and it takes about 2 secs to navigate between pages. I have already used SQL Profiler and monitor the calls to the SQL server. All SQLs looks normal to me and their execution time is always about 1 or 2 millisecs.

I tried the same application in another PC and it is the same. So, it is not because of my computer performance.

If you want to have a look at my sample application, you can download at http://www.mediafire.com/download.php?rudid9w22id1dmp

The database is under App_Data and you might need SQLExpress 2005.

Thank you very much for your help in advance.

+1  A: 

Enable Tracing and see if that helps you to find the bottleneck as it doesn't sound like an SQL issue.

http://www.asp101.com/articles/robert/tracing/default.asp

Chris Diver
+1  A: 

Are you pre-compiling any of your Linq-to-Sql calls? This does help a lot for frequently used queries, for example:

public static class Queries
{
    private static readonly Func<MyDatContext, string, IQueryable<User>> GetUserCompiled
        = CompiledQuery.Compile<MyDataContext, string, IQueryable<User>>
            (context, username) => context.Users.Where(u => u.Username.Equals(username));

    public static User GetUser(string username) {
        using (var context = new MyDataContext()) {
            return GetUserCompiled(context, username).SingleOrDefault();
        }
    }
}

For queries that you run frequently, this is enormously beneficial.

Matthew Abbott
+1  A: 

If your SQL is normal and the calls are always 1-2ms, perhaps it's not the linq-to-sql that's the problem?

Dan Puzey