1
Vote

Performance issue

description

Hello, I got a very slow website using N2CMS. I put online www.spestrie.ca few weeks ago and I struggle how to make it faster. Sometime, a page can take 10 seconds to load. The version of packages I use are:

<package id="N2CMS" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Config" version="2.6.2" targetFramework="net452" />
<package id="N2CMS.Dinamico" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Library" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Management" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Mvc" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Razor" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.ReusableParts" version="2.9.6.8" targetFramework="net452" />
<package id="N2CMS.Search.Lucene" version="2.9.6.8" targetFramework="net452" />

What can I possibly do to make the website faster??

Thank you!

comments

vialeda wrote Sep 1, 2016 at 8:22 PM

By the way, I updated to the latest version (2.9.6.13) and it is a little bit faster, but still too slow. Instead of waiting 10 to 25 seconds, it takes 5 to 12 seconds.

vialeda wrote Sep 3, 2016 at 12:18 AM

Another thing I notice about the performance!! Every page of the website that have a custom controller that inherit of the ContentItem pattern take much longer to load. Even if the controller have simple logic behind!

libardo wrote Sep 5, 2016 at 8:27 PM

Hi! What kind of hosting are you using? I've noticed N2 needs a few hundred megs of ram during peaks.

Also, could you post your next issue to https://github.com/n2cms/n2cms? Thanks!

/Cristian

vialeda wrote Sep 6, 2016 at 3:02 PM

Hi libardo, I host the website on Windows Azure with a Standard plan (1 core, 1,75 GO memory ram). Last week, I tried two cores with 3,5 GO of memory ram but I saw not enough performance improvement to pay for it so I selected back the 1 core plan.

No prob to use github :)

David

libardo wrote Sep 7, 2016 at 7:20 AM

Hmm, what database plan are you using? The lower sql azure tiers are extremely slow. Does speed increase as things get cached up by the site?

Also, could you run a verbose trace log to see what the bulk of the time is going to?

vialeda wrote Sep 11, 2016 at 7:35 PM

Since the website is online, I was using the plan S0. I tried S1 which is a little bit better and I gain nothing as performance boost. I did not try yet caching all pages, but yes I guess it will be faster if I do except the first time. I'm not sure yet how to execute a verbose trace log with SQL Azure. I'll try to find it this week.

For your info, I builded http://lagrandecourse.ca last year for the same non profit organisation and it run fast on every page even with no caching and I still use Azure as hosting plan with the same settings as http://spestrie.ca. The main difference is that I don't use any CMS for lagrandecourse.ca.

You know, with spestrie.ca, each page that inherit of contentItem<...> take much time to load. Even the "login" page which is very simple or even "open an account". I guess there is something behind in the way of building the ContentItem that requires a lot of process time. Perhaps a "join" or a "children collection".

Anyway, I will cache all the pages for now, but if I could have some time, I'm curious to see if something could be optimized from the CMS code directly with some of the great tools of visual studio. That could be worth it.

Regards

vialeda wrote Sep 11, 2016 at 9:12 PM

I did few others tests and it appears you're right!!

I ran a page on the website without any ContentItem and without any database query and the site was fast as hell.

I did another test without any ContentItem but with a query to the database and the site was very slow (18 to 20 seconds to get the data)

I did another test with a ContentItem and with a query to the database and the site was also very slow (also 18 to 20 seconds to get the data)

I tried the premium database service from Azure and it changed nothing! It took up to 20 seconds to get the data too.

I think I got no other choice to change my SQL service provider. I can't let the website be so slow. But I still don't understand why the other website is fast and I would say "normal" about the performance without the use of the cache.

vialeda wrote Sep 13, 2016 at 3:07 AM

I found something new!!! Is it normal that a crazy number of requests are sent to the database to open a simple webpage?
For spestrie.ca I use two databases, one for the cms configs and another database for the other data.
If I open a page that require some data from my second database, I fall into the problem. Otherwise, N2CMS database is fast and running well.

The second database use the latest MVC5 Identity pattern.

public IdentityDbContext()
        : base("ConnectionString")
    { } 
with Owin...
[assembly: OwinStartup(typeof(Startup))]

This lines above are called many many time, it's almost an infinite loop.
I'm note sure if it is related to the fact I got two databases, and N2CMS repeat something in its code behind? I looked with my other websites with no cms and the IdentityDbContext is hit 4 times per page...

libardo wrote Sep 15, 2016 at 6:46 AM

Sorry, I have little hands on experience with OWIN auth. Does it have an option to save credentials in a cookie?

vialeda wrote Sep 15, 2016 at 1:23 PM

Yes it does by default. In the next few weeks, I'll have to try to merge both databases, but I'm not sure about the authentification system. Both are different. If I succeed, I'm pretty sure that will solve the issue, because the N2CMS database is as fast as the other web projects.