Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Following is the Url for my website, http://www.price-tag.org . If you visit any category link, you will see it performing very slow. For example, if you visit http://www.price-tag.org/Store/Section/Computers , you will see a lag before the sub categories are loaded.

This is just the very first phase and i have just added few categories to the database and nothing much. If it's working like this in the very beginning, what will happen when I start adding products.

I am using Entity Framework Code-first approach. Following is the code for one of the action that retrieves the list of categories.

PriceCompareEntity pe = new PriceCompareEntity();
    //
    // GET: /Store/
public ActionResult Section(string id)
{
    if (!string.IsNullOrEmpty(id))
    {
        var catsAndSub = pe.Categories.Where(cat => cat.Name == id).FirstOrDefault();
        if (catsAndSub == null || catsAndSub.ParentCategoryId != null)
        {
            return View("NoSuchRootCat");
        }
        else
        {
            ViewBag.Title = catsAndSub.MetaTitle;
            ViewBag.Description = catsAndSub.MetaDescription;
            ViewBag.Keywords = catsAndSub.MetaKeywords;
            return View(catsAndSub);
        }
    }
    else
    {
        return View("NoSuchRootCat");
    }
}

I am really worried and bit disappointed. After so much of hard work for last month or two, the results aren't any good. If things are going to be this slow, my whole project will sink. Can't imagine how slow will it be if i add a few hundreds of products to the site. Nobody's gonna bother visiting a dodo website.

Have I done something wrong in the development ? And What can i do to get things right and straight. While surfing net, i came across web cache and other stuff, but they are very advanced and need quite bit learning. Besides, my website isn't any facebook or SO with millions of user so going that advanced into the subject seems a far cry and will take a lot of time to get things done.

Update

I have taken down the website, so links might not show the original content.

share|improve this question
2  
What kind or server are you running on (hardware and software)? Also what else is running on the server? –  JonnyBoats Dec 23 '11 at 14:02
4  
It won't matter how quick the site loads if it looks like that. –  ioSamurai Dec 23 '11 at 14:08
1  
Yellow Screen: There is a file sharing violation. A different process might be using the file. [ D:\Hosting\8750445\html\App_Data\PriceCompare-Prod.sdf ] –  Mike L. Dec 23 '11 at 14:11
1  
Pankaj: Many people have reported performance problems with asp.Net MVC-3 websites on GoDaddy shared hosting. You should seriously re-evaluate if this is appropriate hosting for your site, particularly if you expect traffic growth and reasonable response times. –  JonnyBoats Dec 23 '11 at 14:23
6  
@PankajUpadhyay Well to be honest it's a bit with the fact there are so many different fonts and font sizes mixed about, and the layout is a bit zany. Also, the wording is frankly horid: "Find it NOW", "VALUE 4 ur MONEY", "It's NOT Always about>>"..., etc, there is no consistent message on the page. Basically looks like a spam site you land on when your DNS fails to find an actual website. Also some images are skewed and grainy. You should fix the copy, pick a single font type face (and adjust the sizes to match the content), and get some images that match each other for pixel ratio. –  ioSamurai Dec 23 '11 at 15:16
show 10 more comments

3 Answers

up vote 3 down vote accepted

In response to Matthieu's comment the problem likely isn't Linq though as the additional cost for using Linq queries is trivial. The performance bottleneck has to be one of the few options:

  • The database query that is generated by EntityFramework is inefficient and causing a performance bottleneck. Turn SQL logging on and view the Category queries being sent to the database. If they appear to be okay then try running an Explain Plan on them for more detailed information on how the database engine is interpreting the query. Perhaps your database needs updated statistics or more indexes?

  • It could be underpowered hardware. Look closely at system resources and make sure they are sufficient.

  • Did you rule out the ASP.NET first-load wait time? When ASP.NET pages are accessed for the first time after a deployment, IIS will compile them on request. This page compilation can take awhile but it only happens after a deploy or change to pages.

EDIT: From Wikipedia on SQL Server CE - Microsoft SQL Server Compact (SQL CE) is a compact relational database produced by Microsoft for applications that run on mobile devices and desktops. also SQL CE databases reside in a single .sdf file,[12] which can be up to 4 GB in size

So basically SDF files are intended to be used as relational datastores for stand-alone desktop applications and embedded devices. The process that is using it shares the same memory pool, meaning that a process must lock the file to use it. This means that only a single user could be using your website at the same time.

Based on all of this information, SDF files are clearly not intended for web applications.

share|improve this answer
    
i have deployed the website few hours ago. lets see..BTW some time it gives error :- There is a file sharing violation. A different process might be using the file. [D:\Hosting\8750445\html\App_Data\PriceCompare-Prod.sdf] –  Pankaj Upadhyay Dec 23 '11 at 14:18
    
I see that this error occurs to me and for others when i am trying to add products to the database. What can i do to avoid this –  Pankaj Upadhyay Dec 23 '11 at 14:23
    
@maple_shaft : Agreed. On small range of data, difference should be trivial. –  Matthieu Dec 23 '11 at 14:25
    
@PankajUpadhyay Is this shared hosting? Do you have access to SSH or remote desktop this hosting machine? The problem is your database file is being locked by another process. I don't know enough about working with SQLServer CE files to say what could cause this. My guess is though that if you are concerned about performance that you shouldn't use SDF files though, I don't think they were intended to be used for a large multi-user web application. You should consider a full SQL Server installation instead. I have never hosted a site with SQLServer before so I do not know whats out there. –  maple_shaft Dec 23 '11 at 14:29
1  
@maple_shaft , I will try to implement the SQL Server database and see if there is any change in performance. If still, its same, then i think godaddy isn't the bet for asp.net mvc. Infact i needed to deploy all mvc assemblies to make the site work –  Pankaj Upadhyay Dec 23 '11 at 14:33
show 3 more comments

Are the table fields in your where clause indexed? You don't want to be searching the tables for text(varchar) fields when you can be using indexes. Primary keys are probably taken care of by the framework.

share|improve this answer
    
no they are not indexed. Actually using an id parameter negates the naming. Will see what can be done in this regard.... –  Pankaj Upadhyay Dec 23 '11 at 16:41
add comment

It's very difficult to tell. Have you tried using some Profiler to see what's the bottleneck?

EQATEC (free): http://eqatec.com/Profiler/Home.aspx
ANTS (commercial): http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/

share|improve this answer
    
i haven't seen any of these before....will give them a shot soon –  Pankaj Upadhyay Dec 23 '11 at 16:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.