Slow Initial Site Load

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Slow Initial Site Load

Post by drollins » Fri Nov 16, 2007 3:31 pm

It takes my site up to 20 seconds to load the first time I hit it after the site is not used for a while.

Is this due to a recompilation, caching? I would hate to use a ping site to keep this thing up and running and that first hit after a period of no use is gonna make my customer a bit gun shy.

What techniques should I use to keep this site up and running so that when you hit it is fast!

FYI - this is a hosted site and I do NOT have IIS admin permissions etc. I could perhaps ask them to change the app pool settings for this site

Also - I have NO products loaded

SQL Server 2005

Any suggestions or help would be appreciated.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Sat Nov 17, 2007 6:44 am

I have requested my isp increase the app pool expiration time frame and have assigned a service to ping the site every 15 min.

I will also pre-compile the site once I have it stable (currently in dev mode)

I will keep you posted on my progress.

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Post by NC Software » Sat Nov 17, 2007 12:11 pm

I would not suggest pre-compiling your site. It is normal if your site gets no activity for it to delay as you are seeing. If your site is not getting any activity, it's probably a moot point, but if you want to keep your site "alive" then you would have to use a ping utility such as:

http://www.smartertools.com/forums/t/14404.aspx
Neal Culiner
NC Software, Inc.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Sat Nov 17, 2007 5:38 pm

The ping server I use seems to be doing the trick - once this site goes live then we will see if it is even needed.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Post by AbleMods » Sat Nov 17, 2007 8:23 pm

Pinging would solve it but it's only addressing the symptom. Increasing your app pool expiration is the real solution.

Is your site hosted on a shared provider? I tried running AC7 on Discountasp.Net sharing hosting and performance was horrible. 30 secs to bring the first page, 8-10 seconds between pages.

I ended up buying my own server (Proliant DL360) on Ebay for under a grand. First load is less than 5 seconds and subsequent pages snap almost instantly.

I'm sure bandwidth had something to do with my initial performance issues, but not all of it.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
NC Software
AbleCommerce Partner
AbleCommerce Partner
Posts: 4620
Joined: Mon Sep 13, 2004 6:06 pm
Contact:

Post by NC Software » Sun Nov 18, 2007 6:29 am

I do not recommend changing the AppPool, you are not fixing the problem. The problem you need to fix is your lack of traffic. Pinging should not be required, and as I stated, if no one is coming to your site, it's a moot point, you are simply causing the server to work needlessly. Get AC7 in production, work hard on SEO, get some advertising out there, etc. and all problems will be solved.

On a side note, I've heard good reviews of DiscountASP.net and I recommend them. You may have had some bad luck in having a bad neighbor which could have been solved by asking to be moved, etc. Dedicated/owned is always the way to go if/when you can afford it. Ultimately, colocation - buy your own servers, pay for rack space, enjoy the comforts of ownership and not sharing with unknowns!
Neal Culiner
NC Software, Inc.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Post by Logan Rhodehamel » Mon Nov 19, 2007 12:56 pm

Pinging is a suitable solution if you do not have the ability to modify the app pool settings. I had toyed with including an automatic keep alive in this version, but opted not to. (It is possible that future feature enhancements may require us to keep the application alive during periods of non-activity.)
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Wed Nov 28, 2007 3:15 am

Well as it turns out pinging (in a really healthy scenario) might actually work - but in this case I ended up just getting an application_start being logged every time the site got pinged.

My ISP tells me that the app pool this application is running under has no time out.

They just recently (today) put the site in its own app pool so we will see where this goes. They are also going to monitor the shared server to see if any other site is the culprit (with my luck it will probably be one of my changes to a custom conlib file :))

Anyways... I will keep you posted on my progress.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Wed Nov 28, 2007 3:25 am

One more thing.... I am now logging (via global.asax) all application events so we will see what this yields - see the code below. If anyone sees a problem with what I have posted here holler!

Note: My file permissions are set so that the ASPNET user has write access to the /app_data folder - this solution does not work unless you have permissions set this way on your installation

Use this at your own risk.

BACK UP YOUR ORIGINAL VERSION OF GLOBAL.ASAX BEFORE USING THIS CODE!!!

Code: Select all


@ Application Classname="AcApp" Language="C#"  
@ Import namespace="System.Diagnostics" 
@ Import namespace="System.Reflection" 
@ Import namespace="CommerceBuilder.Utility" 

<script>
        
    protected void Application_BeginRequest(object sender, EventArgs e)
    {
        //NO TASKS
    }

    protected void Session_OnStart()
    {
        //SAVE THE REFERRER FOR USE BY THE ORDER MODULE
        if (Request.UrlReferrer != null) Session["SessionReferrerUrl"] = Request.UrlReferrer.ToString();
    }
   
    protected void Application_Start(object sender, EventArgs e)
    {
        CommerceBuilder.Utility.Logger.Info("App Started: " + DateTime.Now.ToString());            
    }

    protected void Application_Error(object sender, EventArgs e)
    {
        CommerceBuilder.Utility.Logger.Error("App Error:", Server.GetLastError().GetBaseException());
        Server.ClearError();
    }

    protected void Application_End(object sender, EventArgs e)
    {

        CommerceBuilder.Utility.Logger.Info("App Ended: " + DateTime.Now.ToString());

        //try
        //{
        //    HttpRuntime runtime =
        //        (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime",
        //                        BindingFlags.NonPublic
        //                        | BindingFlags.Static
        //                        | BindingFlags.GetField,
        //                        null,
        //                        null,
        //                        null);
        //    if (runtime == null)
        //    {
        //        CommerceBuilder.Utility.Logger.Info("Shutting down - runtime is null");
        //        return;
        //    }

        //    string shutDownMessage =
        //        (string)runtime.GetType().InvokeMember("_shutDownMessage",
        //                        BindingFlags.NonPublic
        //                        | BindingFlags.Instance
        //                        | BindingFlags.GetField,
        //                        null,
        //                        runtime,
        //                        null);


        //    string shutDownStack =
        //        (string)runtime.GetType().InvokeMember("_shutDownStack",
        //                       BindingFlags.NonPublic
        //                       | BindingFlags.Instance
        //                       | BindingFlags.GetField,
        //                       null,
        //                       runtime,
        //                       null);

        //    try
        //    {
        //        CommerceBuilder.Utility.Logger.Info("App Ended: " + shutDownMessage + ": " + shutDownStack);
        //    }
        //    catch (Exception ex)
        //    {
        //        CommerceBuilder.Utility.Logger.Info("App Ended", ex);
        //    }
        //}
        //catch (Exception ex)
        //{
        //    CommerceBuilder.Utility.Logger.Info("App Ended", ex);
        //}
    }        
    
</script>
Last edited by drollins on Thu Dec 06, 2007 4:24 am, edited 2 times in total.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Wed Nov 28, 2007 3:56 am

One more note.....

You do need permissions to make private reflection calls (which I believe can be turned off via code-access security) -- so that might be an issue depending upon how your security is setup on your ISP

See this article for more info: http://weblogs.asp.net/scottgu/archive/ ... 33194.aspx

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Post by sohaib » Wed Nov 28, 2007 6:09 am

If I remember right, we have recently fixed the maintenance routines so that they run in a separate thread on startup. This should also help improve the first time startup of the application.

drollins
Lieutenant (LT)
Lieutenant (LT)
Posts: 79
Joined: Thu Oct 04, 2007 9:23 am
Location: West Hartford, CT
Contact:

Post by drollins » Thu Dec 06, 2007 4:30 am

So...... using this code I've posted I found out that my site was being idled by IIS after 20 min even after they turned off the idle time out on the app pool I was running under.

There seems to be a bug with IIS so....

My isp then explicitly configured the element hostingEnvironment for my website and set idleTimeout to Infinite ... this seemed to to the trick.

My site now is up and running 24/7 always loaded always ready ...

I can now sleep at night ...

Post Reply