Question

I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it's my app not their servers. Has anyone had similar performance issues with ORM based sites when being hosted at the public hosting companies?

Also, what hosting company would you recommend for hosting websites? I tried godaddy but couldn't use them 'cause they don't allow running website in full trust which is apparently required for nHibernate.


I configured nHibernate using xml configuration files, opening sessions in the following way:

using (ISession session = _sessionManager.OpenSession())
{         
ICriteria crit = session.CreateCriteria(typeof(Content));
   return crit.List();
}

Also in the Application_Start I have the following code:

private static WindsorContainer container;
if (container == null)
   {
     container = new WindsorContainer(new XmlInterpreter(filePath));
      Application[Constant.CastleWindsorAppKey] = container;
    }
Was it helpful?

Solution

You don't know how slow your application is when you don't measure it. I'm using a timing http module during development to notice big performance issues fast. When one of your pages loads slow, you should use a profiler to find the exact bottle neck. I'm using NHibernate for my current project and I don't have any performance issues with it. My most complex queries involve a complex object graph of 10 different classes and with their NHibernate mappings takes 0.082 seconds to execute. The main bottle-neck in that application is rendering the html aspx template to the response (that takes 0.5 seconds). Performance issues are often in dataaccess, but you can not be sure unless you measure it.

OTHER TIPS

Without doing any kind of instrumentation you are just guessing. You need to wrap a timing proxy around your db calls. Then log how long each call takes. If this is where your time is being spent then you have the information necessary to proceed.

Assuming you are using a shared hosting environment, it's probably not your app. I've seen perfectly fine code grind to a halt on a shared host. The only solution I know for shared hosting problems is some kind of managed app host, getting a virtual private server (managed or not), or a dedicated server box. This type of service is more expensive than shared hosting.

As for hosting recommendations for windows, I'm sorry that I don't have any.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top