Very slow when saving page

Vote:
 

Hi,

When a user is saving a page after som changes has been done the save process takes up to 2 minutes. Otherwise the site is working more or less fine when it comes to preformance.

Can anyone please help on this topic. Where can I start look for any solution for this issue.

I am using CMS 5.

 Thanx in advance.

 

AJ

#20059
May 20, 2008 10:23
Vote:
 
Have you attached any events to savepage?
#20060
May 20, 2008 10:46
jo
Vote:
 

Hi Adnan!

Do you see the CPU % go up during these 2 minutes?

If CPU is low, then theres probably some locks blocking the thread, and if its high the most likely cause would be some massive code executing,

In either way, this would be a perfect challenge for using the Debugging tools for Windows to grab a dump of the workerprocess during this period and then inspect using WinDBG + SOS.dll. More on this on Tess Fernandez most excellent blog: http://blogs.msdn.com/tess

One quite common pitfall is hooking the DataFactory SavePage event to an Page/WebControl-*instance* method, in which case the event would never be released but will stay around forever making performance degrading over time.

An example of such inappropriate code would be:

public class MyPage : Page
{
  protected override void OnInit( EventArgs ea )
  {
    EPiServer.DataFactory.Instance.SavedPage += new PageEventHandler( PageSaved);
  }

  protected void PageSaved(object sender, PageEventArgs ea)
  {
  }
}

The solution in this case would be to a) make the eventhandler PageSaved static and b) checking that the event hasnt already been hooked before hooking.

/johan

#20064
May 20, 2008 11:31
Vote:
 

hi,

 Yes there is an event attached to the savepage.

I just wrote som code to log the time used in the savepage event.

I dont know the outcome yet, but thanx for the tip so far!

AJ

#20065
May 20, 2008 11:35
Vote:
 

Hi Adnan

I'd suggest that you enable EPiServers logging on DEBUG level, and try to "capture" one save event. That should give some more clues as to what is actually happening that is taking so long time.

Read to FAQ below on how to log in EPiServer:

http://world.episerver.com/FAQ/Items/How-do-I-create-a-log-in-EPiServer/

Regards
Per Gunsarfs
EPiServer Development Team

#20067
May 20, 2008 11:42
Vote:
 

Hi,

After some logging I found out that the event on pagesave was executing several times when clicked once on "Save". I solved it by adding a check before I attach the event to the pagesave in the base class.

Most likely this was causing the save issues on the live server. If not I will let you know.

Thank u all for the help!!!

 

AJ

#20081
May 20, 2008 13:19