Slow Page Loads

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Its just slowed down again having run well all morning....

I have checked the SQL profiler and its not down to that, I have one or two long running queries but they run fast and do not have missing indexes like before so there must be something else going on - something else that makes them run slow at times but fast at others - it has been like this - slow one minute and fast the next although I am improving matters. I increased server memory to 3Gb from 2Gb last week to improve matters. I will update this thread when I find it..
13 years ago
I checked and it's not a bandwith problem.

It must be on your server. Best is to find out what is causing the slowness: http://articles.sitepoint.com/article/aspnet-performance-tips

IIS Trace and Profiler are your tools.
13 years ago
Its not in the SQL, there are other issues I think. I'm just trying a site on another server. I'll update this thread when I find them...
13 years ago
ericsolan wrote:
What is actually happening is that your site is being compiled after the ASP.NET worker process has restarted anytime there is a lack of activity on your site. The worker process can restart for many reasons, however the most troubling one is due to site traffic. By default IIS will shut down the ASP.NET worker process after 20 minutes of inactivity meaning that the next request will restart the worker process and have to compile your entire nopCommerce site all over again.

To prevent this, a web request has to be made to one of your pages at MAX every 19 minutes. I recommend that folks take advantage of the built-in keep-alive function in nopCommerce. NopCommerce already has a keepalive Ping page set up in your file system.

For Windows (IIS) Shared Hosting on Godaddy:

1. Register for a free web cron job, try http://www.setcronjob.com or http://www.keepaliveforever.com.
2. Create a new cron job to hit the following page of your site:  http://www.yoursite.com/KeepAlive/Ping.ashx every 10 or 15 minutes

This ping should prevent the ASP.NET worker process from shutting down and having to recompile every time there is a lack of activity on your site.


I am having the same issues.  It takes a little over a minute for the first page to load, then all the other pages load pretty fast. I had a look at both of these sites (http://www.setcronjob.com or http://www.keepaliveforever.com) and it says they are only for Linux.  Are you saying they will work for Windows too?

Chad
13 years ago
I think the SQL is ok, certainly the problems I have found have been fixed its something else now, page load speed about 10 seconds after some config changes (memory) on the server... I'll update this thread when I find it..
13 years ago
Just seen these other posts, I've got keep alive on... If only it was as simple as the first access after a few minutes... Its consistently slow, then it goes fast for a few hours, and then its slow again, I mean when I'm continously browsing. When I go into the product details page its using 30% CPU on my 4 processor server, and all the indexes are ok...
13 years ago
So it seems IIS related? I the speed different on a test server?
13 years ago
I've found it! There is nothing wrong with the SQL now that I've put the indexes on. The problem had to lie in another area. I've checked everything I can think of, statistics, index fragmentation, all sorts of memory issues. Couldn't find it, so I went back to basics and ran debug on the code.

The code in Modules/RelatedProducts.ascx.cs turned out to be the culprit.

                var products = ProductManager.GetAllProducts(0,
                    0, 0, null, null, null, this.ProductId, string.Empty, false, int.MaxValue,
                    0, null, NopContext.Current.WorkingLanguage.LanguageId,
                    ProductSortingEnum.Position, out totalRecords);

I changed the code to:

                var products = ProductManager.GetRelatedProductsByProductId1(this.ProductId);

And this finally resolved it.

I think that the stored procedure underlying the first call is very resource intensive and I'm going to  look for other occurances of it in the public site and re-code as necessary.
13 years ago
Did you look at this one: http://www.fuzionagency.com/?tag=/NOP+Commerce
13 years ago
I have looked at this thread but there was a bug in the code and it was only marginly faster.

https://www.nopcommerce.com/boards/t/6830/nop_productloadallpaged-performance.aspx

I think that calling nop_productloadallpaged when not paging is unnecessary.

Yes, this procedure needs improving, but for now I am going to remove this and replace with linq procedures - these are many, many times faster, between 10 and 20 seconds quicker on my system.

By the way, there was a bug in the code in the previous post - the function has to return Product, not RelatedProduct so I have amended the line of code to:

                var products = ProductManager.GetProductsRelatedByProductId1(this.ProductId);

And I have created a new function to do this in ProductManager.cs

       /// <summary>
        /// Return the products themselves not the related products
        /// </summary>
        /// <param name="productId1"></param>
        /// <returns></returns>
        public static List<Product> GetProductsRelatedByProductId1(int productId1)
        {
            bool showHidden = NopContext.Current.IsAdmin;

            var context = ObjectContextHelper.CurrentObjectContext;
            var query = from rp in context.RelatedProducts
                        join p in context.Products on rp.ProductId2 equals p.ProductId
                        where rp.ProductId1 == productId1 &&
                        !p.Deleted &&
                        (showHidden || p.Published)
                        orderby rp.DisplayOrder
                        select p;

            var products = query.ToList();
            return products;
        }

Tested, it appears to work ok.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.