Deleting a page is very slow

Permalink 1 user found helpful
Hi,

I have a site with 200+ pages. When i try to delete a page, i get the loading icon forever.

The site itself seem fairly fast but that one task is the one that always spins forever.

I hope someone had this experience. Searched the forum and couldn't find anything related.

Thanks

Francois
 
Francois replied on at Permalink Reply
Francois
I am still investigating this and found out that it actually reaches the PHP timeout limit.

It seems that the delete function from the CollectionVersion object can take up to 5 seconds to run?!

Any suggestion on making the DB transactions faster?
andrew replied on at Permalink Reply
andrew
What web host are you on? How many page versions are on these pages? This seems really high. We delete pages with many many versions on them and don't experience this. It's true that delete not only deletes a lot of data but also deletes cache entries, which could be slow if you have a slow filesystem.
ugolfmedia replied on at Permalink Reply
Hi guys. I'm experiencing this problem and it really is a pain in the ass. Having just uploaded over 5000 images to hundreds of sets then there is absolutely no problem with the speed of those many many transactions but something as simple as deleting a sibling page... the system just doesn’t want to know and times out every single time. I have several sibling pages that I added in error and now cannot delete them. On a similar issue the time out seems to be a constant issue when trying to work on pages. Why is this? Could someone please explain because there was not a moment of problem with the enormous task of uploading all those images which I was expecting there to be! I am new to CMS and knew it would be a long learning curve but have been delighted with C5 until now. I am getting really fed up waiting for something to happen when working on pages. Is this C5, my hosting company or just my old age!!!!
frz replied on at Permalink Reply
frz
That's pretty odd.

Is it slow when deleting from the sitemap as well as from the page itself?
best wishes

Franz Maruna
CEO - concrete5.org
http://about.me/frz
ugolfmedia replied on at Permalink Reply
Hi Franz... I have only tried deleting from the sitemap. The time out happens an awful lot and what is more worrying is that the index page seems to take quite a while to load (even before all the images were uploaded) and then once signed in quite often a full page doesn't load so have to refresh until it does. Do you think this is a problem with the host server? I could really do with getting to the bottom of this as I have a lot of work to do yet on this site and on this basis it will take a month of Sundays!!
Fernandos replied on at Permalink Reply
Fernandos
You can try to delete pages through this dashboard page, it might react faster.
/dashboard/sitemap/explore/

I'm not sure, but it sounds to me as if you're on a shared host, which tend to have peak times where everything appears slow. I've worked on sites with >5000 pages and it was reasonably fast. The only time I experience that same error was when I screwed the header_required.php (jqueryui). Of course a javascript error which happened after an unsuccessfull callback was the reason. However to check if that's the case just go and look for errors in the FireBug/Chrome WebInspector Console. If that's the case report back.
ugolfmedia replied on at Permalink Reply
Hi Franz... just to let you know that after many issues along the way I have now managed to solve the problem... a shared hosting! Thanks for the pointer in that direction and my host company did begin to realise it was this. They allowed me to migrate to a seperate business server free of charge whilst I checked this out and sure enough it has done the trick. Many thanks.
frz replied on at Permalink Reply
frz
Glad to hear it worked out in the end!

best wishes

Franz Maruna
CEO - concrete5.org
http://about.me/frz
benede replied on at Permalink Reply
benede
Hi there,

I know this is an old thread but I've been experiencing veeeeery slow deletes on a site with 10,000 pages.

Underpowered servers are not the problem here, we're on a load balanced solution with a separate db server (a fine beast of a server it is too).

But now even deleting a single page times out (we're still using standard 30 second timeout).

So, the problem seems to be on this query from Block.php line (1123):

SELECT cID, cvID, arHandle FROM CollectionVersionBlocks WHERE bID=X


This is returning over 13,000 rows which it then loops through deleting the cache. Slow!

Is this by any chance an over zealous query, I tested updating the query to include the cID from the block obj ($this->cID) and the delete process now zips along.

I'm 99% sure this is a valid fix, but wondered if Franz, you had a view on this, am I missing something or have I just contributed to a great C5 speed enhancement (Cake please!).

Cheers

Ben

P.S the 13,000 CollectionVersionBlocks per block ID are (I assume) due to all the pages having a reference to the same footer block.
andrew replied on at Permalink Reply
andrew
Hmm, this sounds interesting. I will definitely go through this.
griebel replied on at Permalink Reply
griebel
I had the same problem, a clients site got slower and slower when deleting pages and childs in sitemap, the site have 20.000+ pages.

I got this sql string from Benede, and it solves the problem on large sites.

in /concrete/models/block.php find a change the sql string in the function refreshCacheAll()

old string:
$rows=$db->getAll( 'SELECT cID, cvID, arHandle FROM CollectionVersionBlocks WHERE bID='.intval($this->getBlockID()) );


new string:
$rows=$db->getAll( 'SELECT cID, cvID, arHandle FROM CollectionVersionBlocks WHERE bID='.intval($this->getBlockID()).' AND cID='.intval($this->cID));


Thank you Ben ;)
mkly replied on at Permalink Reply
mkly
refreshCacheAll() could certainly drop it's memory footprint a bunch if it only got the block id once and used a pointer instead of an array
public function refreshCacheAll() {
  $db = Loader::db();
  $bID = $this->getBlockID();
  $rs=$db->Execute( 'SELECT cID, cvID, arHandle FROM CollectionVersionBlocks WHERE bID='.intval($bID) ); 
  while (!$rs->EOF){
    Cache::delete('block', $bID . ':' . intval($rs->fields['cID']) . ':' . intval($rs->fields['cvID']) . ':' . $rs->fields['arHandle'] );
    Cache::delete('block_view_output', $rs->fields['cID'] . ':' . $bID . ':' . $rs->fields['arHandle']);
    Cache::delete('collection_blocks', $rs->fields['cID'] . ':' . $rs->fields['cvID']);
    Cache::delete('block', $bID);
    $rs->MoveNext();
  }
}
nolabel replied on at Permalink Reply
nolabel
Thanks a lot! Really helped.
fastcrash replied on at Permalink Reply
fastcrash
you guys are really a pro. <img src="http://images.forum.idws-static.com/images/smilies/onion-09.gif" />

10000 - 20000 page? OMG! can't imagine it, what kind of site is that?

can u guys show me the link site, i really want to see it, the site with 10k page

psstt : or pm me the link please really appreciate :)
griebel replied on at Permalink Reply
griebel
Hi fastcrash,

It's not a problem reaching thousands of pages, in my clients case, they have 1xConcrete5 platform to serve all their domains, with international site and local country sites. I use the domainmapper add-on as the magic glue.
webmaster55 replied on at Permalink Reply
I'm having the same problem of spinning forever when deleting a page. I did find two errors using Firebug when I tried to do the delete. First was a "500 Internal Server Error." Second was a Javascript syntax error in the jquery.js code. Below is the code that supposedly caused this second error.

$(function() {
   $("#ccmDeletePageForm").ajaxForm({
      type: 'POST',
      iframe: true,
      beforeSubmit: function() {
         jQuery.fn.dialog.showLoader();
      },
      success: function(r) {
         var r = eval('(' + r + ')');
         if (r != null && r.rel == 'SITEMAP') {
            jQuery.fn.dialog.hideLoader();
            jQuery.fn.dialog.closeTop();
            if (r.deferred) {
                ccmAlert.hud(ccmi18n_sitemap.deletePageSuccessDeferredMsg, 2000, 'delete_small', ccmi18n_sitemap.deletePage);
            } else {


The Firebug error message is vague and doesn't make sense according to the code above. It says error on line 1, column 1, at the () parenthesis. I'm not an expert, but the first couple lines look syntactically correct.

I can't even find the JS file with this code in it. Firebug does say that it is one of the jquery.js files, but the full file name is listed as
jquery.js?v=[a long numeric code] line 2 > eval

I'm not sure what the appended "line 2 > eval" is all about, but from some quick research I'd guess this JS code was generated dynamically and therefore hard to debug.

Anyway, the indefinite holdup during deletion seems to be from this JS error. I have no idea how to fix it or if there is a round-about solution. Any help would be greatly appreciated.
glu replied on at Permalink Reply
glu
I ran into the same error as yours - I was trying to delete a page type from ...page defaults. Then I discovered it is not the right place :)

Maybe some dedicated error message if someone tries to delete a Master Collection would help?
PS. I am (still) using 5.6.2.1.