Keyword

High cpu usage

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago #166279 by Charles
High cpu usage was created by Charles
Hello,

I have a lot of problem with high cpu usage. My provider send me a sql query, i tried to debug it without success.

SQL QUERY :
| 2221668 | dbname | localhost | dbname | Query | 1 | Copying to tmp table | SELECT DISTINCT i.*,c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS | 0.000 |

Joomla version : 3.8.3
K2 : 2.8.0
More than : 10 000 items in k2
Cache is enabled.

Do you have a solution for this ?
Thank's in advance.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #166283 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
Hello,

Is this the entire query? I think some parts are missing.

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago #166287 by Charles
Replied by Charles on topic High cpu usage
My provider said the sql query are not loged...

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago #166302 by Charles
Replied by Charles on topic High cpu usage
Hello,

I have more information about this SQL :
SELECT DISTINCT i.*,c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams 
  FROM mydb_k2_items as i RIGHT JOIN mydb_k2_categories c 
  ON c.id = i.catid 
  WHERE i.published = 1 
  AND i.access IN(1,1,2,3,6,7) 
  AND i.trash = 0 
  AND c.published = 1 
  AND c.access IN(1,1,2,3,6,7)  
  AND c.trash = 0 
  AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2018-01-17 16:21:26' ) 
  AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2018-01-17 16:21:26' ) 
  AND i.catid IN(18) 
  ORDER BY i.created DESC 
  LIMIT 0, 10
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	c	const	PRIMARY,category,published,access,trash	PRIMARY	4	const	1	100.00	
1	SIMPLE	i	index	item,catid	created	8	NULL	70	100.00	Using where
Status	Duration
starting	0.02 ms
Waiting for query cache lock	0.00 ms
init	0.00 ms
checking query cache for query	0.06 ms
checking permissions	0.00 ms
checking permissions	0.00 ms
Opening tables	0.02 ms
After opening tables	0.01 ms
System lock	0.00 ms
Table lock	0.00 ms
After opening tables	0.00 ms
Waiting for query cache lock	0.00 ms
After opening tables	0.02 ms
init	0.04 ms
optimizing	0.03 ms
statistics	0.12 ms
preparing	0.06 ms
executing	0.01 ms
Sorting result	0.01 ms
Sending data	0.23 ms
Waiting for query cache lock	0.00 ms
Sending data	0.07 ms
Waiting for query cache lock	0.00 ms
Sending data	0.12 ms
Waiting for query cache lock	0.00 ms
Sending data	0.10 ms
Waiting for query cache lock	0.00 ms
Sending data	0.01 ms
end	0.01 ms
query end	0.01 ms
closing tables	0.01 ms
freeing items	0.01 ms
updating status	0.00 ms
Waiting for query cache lock	0.00 ms
updating status	0.01 ms
Waiting for query cache lock	0.00 ms
updating status	0.00 ms
storing result in query cache	0.01 ms
cleaning up	0.00 ms

And files :
19	JDatabaseDriverMysqli->execute()	JROOT/libraries/joomla/database/driver.php:1691
18	JDatabaseDriver->loadObjectList()	JROOT/modules/mod_k2_content/helper.php:286
17	modK2ContentHelper::getItems()	JROOT/modules/mod_k2_content/mod_k2_content.php:82
16	include JROOT/modules/mod_k2_content/mod_k2_content.php	JROOT/libraries/src/Helper/ModuleHelper.php:201
15	Joomla\CMS\Helper\ModuleHelper::renderModule()	JROOT/modules/mod_sptab/helper.php:31
14	modspTabHelper::getTabs()	JROOT/modules/mod_sptab/mod_sptab.php:84
13	include JROOT/modules/mod_sptab/mod_sptab.php	JROOT/libraries/src/Helper/ModuleHelper.php:201
12	Joomla\CMS\Helper\ModuleHelper::renderModule()	Même appel que celui de la ligne ci-dessous.
11	call_user_func_array()	JROOT/libraries/src/Cache/Controller/CallbackController.php:173
10	Joomla\CMS\Cache\Controller\CallbackController->get()	JROOT/libraries/src/Helper/ModuleHelper.php:610
9	Joomla\CMS\Helper\ModuleHelper::moduleCache()	JROOT/libraries/src/Document/Renderer/Html/ModuleRenderer.php:95
8	Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render()	JROOT/libraries/src/Document/Renderer/Html/ModulesRenderer.php:47
7	Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render()	JROOT/libraries/src/Document/HtmlDocument.php:491
6	Joomla\CMS\Document\HtmlDocument->getBuffer()	JROOT/libraries/src/Document/HtmlDocument.php:782
5	Joomla\CMS\Document\HtmlDocument->_renderTemplate()	JROOT/libraries/src/Document/HtmlDocument.php:557
4	Joomla\CMS\Document\HtmlDocument->render()	JROOT/libraries/src/Application/CMSApplication.php:1117
3	Joomla\CMS\Application\CMSApplication->render()	JROOT/libraries/src/Application/SiteApplication.php:780
2	Joomla\CMS\Application\SiteApplication->render()	JROOT/libraries/src/Application/CMSApplication.php:273
1	Joomla\CMS\Application\CMSApplication->execute()	JROOT/index.php:49

I hope this help you !
Regards,
Charly

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #166307 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
This is most likely an administrator filter.
In K2's advanced settings can you locate the "Disable ordering compacting" setting and disable it?

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago - 7 years 4 months ago #166312 by Charles
Replied by Charles on topic High cpu usage
Thank's for reply.

I have set this option to "No" but the problem persist.

Any idea ?

[Edit]
Last edit: 7 years 4 months ago by Charles.

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago - 7 years 4 months ago #166319 by Charles
Replied by Charles on topic High cpu usage
Hello,

An another query SQL with a too long time execution.
SELECT DISTINCT i.*,c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams 
  FROM mydb_k2_items as i RIGHT JOIN pdyqm_k2_categories c 
  ON c.id = i.catid 
  WHERE i.published = 1 
  AND i.access IN(1,1,2,3,6,7) 
  AND i.trash = 0 
  AND c.published = 1 
  AND c.access IN(1,1,2,3,6,7)  
  AND c.trash = 0 
  AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2018-01-18 11:49:34' ) 
  AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2018-01-18 11:49:34' ) 
  AND i.catid IN (2,3,4,6,7,8,9,10,11,14,21) 
  ORDER BY i.id DESC 
  LIMIT 0, 5
Status	Duration
starting	0.02 ms
Waiting for query cache lock	0.00 ms
init	0.00 ms
checking query cache for query	0.06 ms
checking permissions	0.00 ms
checking permissions	0.00 ms
Opening tables	0.01 ms
After opening tables	0.01 ms
System lock	0.00 ms
Table lock	0.00 ms
After opening tables	0.00 ms
Waiting for query cache lock	0.00 ms
After opening tables	0.02 ms
init	0.04 ms
optimizing	0.02 ms
statistics	0.17 ms
preparing	0.03 ms
executing	0.00 ms
Copying to tmp table	0.16 ms
Copying to tmp table	359.22 ms
Sorting result	14.43 ms
Sending data	0.09 ms
Waiting for query cache lock	0.00 ms
Sending data	0.04 ms
Waiting for query cache lock	0.00 ms
Sending data	0.01 ms
end	0.01 ms
removing tmp table	4.12 ms
end	0.01 ms
query end	0.01 ms
closing tables	0.01 ms
freeing items	0.02 ms
updating status	0.00 ms
Waiting for query cache lock	0.00 ms
updating status	0.01 ms
Waiting for query cache lock	0.00 ms
updating status	0.00 ms
storing result in query cache	0.01 ms
cleaning up	0.00 ms
#	Appel	Fichier et numéro de ligne
16	JDatabaseDriverMysqli->execute()	JROOT/libraries/joomla/database/driver.php:1691
15	JDatabaseDriver->loadObjectList()	JROOT/modules/mod_k2_content/helper.php:286
14	modK2ContentHelper::getItems()	JROOT/modules/mod_k2_content/mod_k2_content.php:82
13	include JROOT/modules/mod_k2_content/mod_k2_content.php	JROOT/libraries/src/Helper/ModuleHelper.php:201
12	Joomla\CMS\Helper\ModuleHelper::renderModule()	Même appel que celui de la ligne ci-dessous.
11	call_user_func_array()	JROOT/libraries/src/Cache/Controller/CallbackController.php:173
10	Joomla\CMS\Cache\Controller\CallbackController->get()	JROOT/libraries/src/Helper/ModuleHelper.php:610
9	Joomla\CMS\Helper\ModuleHelper::moduleCache()	JROOT/libraries/src/Document/Renderer/Html/ModuleRenderer.php:95
8	Joomla\CMS\Document\Renderer\Html\ModuleRenderer->render()	JROOT/libraries/src/Document/Renderer/Html/ModulesRenderer.php:47
7	Joomla\CMS\Document\Renderer\Html\ModulesRenderer->render()	JROOT/libraries/src/Document/HtmlDocument.php:491
6	Joomla\CMS\Document\HtmlDocument->getBuffer()	JROOT/libraries/src/Document/HtmlDocument.php:782
5	Joomla\CMS\Document\HtmlDocument->_renderTemplate()	JROOT/libraries/src/Document/HtmlDocument.php:557
4	Joomla\CMS\Document\HtmlDocument->render()	JROOT/libraries/src/Application/CMSApplication.php:1117
3	Joomla\CMS\Application\CMSApplication->render()	JROOT/libraries/src/Application/SiteApplication.php:780
2	Joomla\CMS\Application\SiteApplication->render()	JROOT/libraries/src/Application/CMSApplication.php:273
1	Joomla\CMS\Application\CMSApplication->execute()	JROOT/index.php:49

Thank's in advance for you're help.
Last edit: 7 years 4 months ago by Charles.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #166320 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
Try setting to yes. Disabling this feature will help your site.

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 4 months ago #166324 by Charles
Replied by Charles on topic High cpu usage
Previously this option was activated. This does not solve the problem.

Do you have another idea?
Regards,
Charly

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 3 months ago #166343 by Charles
Replied by Charles on topic High cpu usage
Hello,

Excuse me for insisting but do you have a solution? My site is often unreachable because of its ...

Regards,
Charly

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #166363 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
Are you on shared hosting/ VPS/ metal?
Are you using any additional K2 extensions?
From a Joomla! debug printscreen it is impossible to pinpoint the issue.

modK2ContentHelper::getItems() Can you send me the settings for this instance of K2 Content?

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 3 months ago #166398 by Charles
Replied by Charles on topic High cpu usage
Thank's for reply.

1 - We are on a VPS

2 - List of k2 extensions :
- Sj K2 Slideshow
- Mod Bt_content_slider
And you're Mod_k2_Content module

3 - Link to lutim for screenshots : lut.im/gallery#dztUJTbWP7/5sQMaVDTUiMtwyei.jpg,NwMrPvUb2C/A8qRuIllovFWoMI2.jpg,QpD093M4WX/wOezvxB9PCweHqdY.jpg,txMhZonXBD/HwhSqJRDIpcdzNwY.jpg

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 3 months ago #166399 by Charles
Replied by Charles on topic High cpu usage
I am trying to replace all btcontentslider modules with the K2 Content module.
I did not know that they could create different templates.
I try and tell you if it works better.
If you ever have any advice do not hesitate.

(Sorry for the Google translate...).

Regards,
Charly

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #166420 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
Let me know, also do send me your server's specs.
If your server is underpowered and you have high traffic maybe an upgrade or a CDN is the way to go.

Please Log in or Create an account to join the conversation.

  • Charles
  • Charles's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 3 months ago #166431 by Charles
Replied by Charles on topic High cpu usage
We have a CPU Xeon E5 (i don't have the exact model)
Ram : 16GB physical and 16GB virtual
500GB SSD Disk

We have 20 000 visitors per day and approximately 200 visitors at the same time and the maximum record is 300.

I have replace a lot of instances of Bt_Content_Slider and the performances are better.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #166458 by Krikor Boghossian
Replied by Krikor Boghossian on topic High cpu usage
Nice to hear this :)
That's a nice machine, you can also experiment with caching and tweak its settings for peak performance.

Please Log in or Create an account to join the conversation.

More
7 years 3 months ago - 7 years 3 months ago #166520 by Kmedia
Replied by Kmedia on topic High cpu usage
Hi, Durand! With those specs your site should be flying! We have a pretty similar site with real time 300-500 active sessions and some 130 000 to 160 000 pageviews on average day.

We have been using K2 for reasons dating back to 2011 and we have had to do some code modifications to get our site in working order. Adding processing power and playing with cache just doesn't cut it. The problem lies deeper.

We have found couple of big resource hogs in the code and we have manually fixed those. Grab a coder somewhere to help you and check this thread: www.joomlaworks.net/forum/k2-en/47858-solved-k2-query-cache-problem#163417

We also had to do the same trick for K2 Images.

And other fix we implemented rose just recently as we moved our site to Amazon AWS: Many of K2 tables use MyISAM as engine and that causes table locks. We suffered a lot of table locks that caused the php-fpm to spawn max childs and then the site went unresponsive for 2-5 minutes until the locking opened. No resource can handle that.

The solution for us was to first convert the table K2_items to innoDB engine. We are converting the rest of the K2 tables to innoDB shortly.

That solved the problem and we have had no table locks since then.

I don't know what are the plans in K2 development are and if Krikor and his colleagues taking notes from these, but currently the underperforming of the component is a huge problem for us in conjunction to the silence around component development and we have started a project to find and alternative.

I hope these help you in your site performing issues!
Last edit: 7 years 3 months ago by Kmedia.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum