By Hossein on Tuesday, 01 July 2014
Posted in Technical Issues
Replies 22
Likes 0
Views 645
Votes 0
I Use the latest version of Joomla 2.5 and EasyDiscuss with both level of caches are enabled. my main concern is performance issue. I have dedicated server with enough resource to handle huge traffic but it cannot handle less than of 3K daily visitor. what should I do to decrease the server Load and increase EasyDiscuss speed.
Thank you for any sort of advices.
Hello Hossein,

Please provide us with the access to the site to review your current configuration
·
Tuesday, 01 July 2014 23:30
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for your reply, the login data is enclosed.
·
Wednesday, 02 July 2014 13:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Hossein,

I have checked your site and it looks like you have configured EasyDiscuss to run on "Optimized" and also "Send email on page load". These actually take up processing time because EasyDiscuss needs to actually process emails when you browse EasyDiscuss. You should use cronjobs to process emails.

Also, in the layout > general settings, it looks like it has been set to cache. When this is set to cache, EasyDiscuss will actually "watch" for changes in the "less" files and compile the css codes (Which also takes some computing power). I have set this to "Off" and the page only takes about 1s to load, which is pretty fast in my opinion because you have close to 9,000 discussions
·
Wednesday, 02 July 2014 23:43
·
0 Likes
·
0 Votes
·
0 Comments
·
thank you for your reply.

I can see the Email on page load is disable, but I can not see the Optimized option. where can I find it?

This is website is going to be very big, is easydicuss can handle huge website?
·
Thursday, 03 July 2014 19:22
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Hossein,

The settings is under General > Maintenance. I believe it should be able to handle it just fine
·
Thursday, 03 July 2014 19:26
·
0 Likes
·
0 Votes
·
0 Comments
·
I don't think so, the server load is around 20 with only 50 people online. there is problem in sql queries. is there any way to optimize that?
·
Thursday, 03 July 2014 19:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Do you have any slow logs being generated?
·
Thursday, 03 July 2014 23:43
·
0 Likes
·
0 Votes
·
0 Comments
·
I will enable the SQL SLOW Log and let you know about the result. Thank You.
·
Friday, 04 July 2014 03:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Subscribed
·
Friday, 04 July 2014 07:24
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Hossein,

Sure, let me know if there's any slow logs generated from EasyDiscuss. Do you have root access to the server?
·
Friday, 04 July 2014 18:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark

Thank you for pursuing my problem.

I logged the slow queries and figure out, some of the queries are extremely slow, some of them takes more than 20sec to process. I attached the query log.
·
Sunday, 06 July 2014 14:50
·
0 Likes
·
0 Votes
·
0 Comments
·
it seems you're in holiday. I confer with of my friends who is talented in SQL and show him the slowlog query. here is his recommendations:

we shouldn't use datediff, it has lots of pressure, I need to use static date, take look at this query:

SELECT DATEDIFF('2014-07-06 09:13:26', a.`created` ) as `noofdays`, DATEDIFF('2014-07-06 09:13:26', IF(a.`replied` = '0000-00-00 00:00:00', a.`created`, a.`replied`) ) as `daydiff`, TIMEDIFF('2014-07-06 09:13:26', IF(a.`replied` = '0000-00-00 00:00:00', a.`created`, a.`replied`) ) as `timediff`, (SELECT COUNT(1) FROM `unurc_discuss_polls` WHERE `post_id` = a.`id`) AS `polls_cnt`, (SELECT COUNT(1) FROM `discuss_favourites` WHERE `post_id` = a.`id`) AS `totalFavourites`,(SELECT COUNT(1) FROM `unurc_discuss_posts` WHERE `parent_id` = a.`id` AND `published`="1") AS `num_replies`, (SELECT COUNT(1) FROM `discuss_attachments` WHERE `uid` = a.`id` AND `type`='questions' AND `published`='1') AS `attachments_cnt`, (SELECT COUNT(1) FROM `discuss_votes` WHERE `post_id` = a.`id` AND `user_id` = '7351') AS `isVoted`, a.`post_status`, a.`post_type`, pt.`suffix` AS post_type_suffix, pt.`title` AS post_type_title , a.*, e.`title` AS `category`, a.`legacy`, IF(a.`replied` = '0000-00-00 00:00:00', a.`created`, a.`replied`) as `lastupdate`, (select count(1) from `discuss_votes` where post_id = a.id) as `total_vote_cnt` FROM `discuss_posts` AS a LEFT JOIN `discuss_post_types` AS pt ON a.`post_type`= pt.`alias` LEFT JOIN `discuss_category` AS e ON a.`category_id`=e.`id` WHERE a.`published` = '1' AND a.`featured` = '0' AND a.`parent_id` = '0' AND a.`answered` = '0' AND a.`category_id` IN ('8','10','13','24','25','26','27','28','29','30','32','3','17','18','19','20','21','22','23','2','31','33','34','35','4','44','45','46','47','48','49','50','51','52','53','5','36','37','38','39','40','41','42','43','54','55','6','56','57','58','59','60','61','62','63','64','65','66','92','7','67','68','69','9','70','71','72','94','11','73','74','75','76','77','12','78','79','80','81','82','83','84','14','85','86','87','88','89','90','91','15','93') AND a.`private`='0' ORDER BY a.`replied` DESC LIMIT 0, 50;
# Query_time: 5.047457 Lock_time: 0.000163 Rows_sent: 48 Rows_examined: 13715

We are not suppose to use IF in SELECT Statement, you should handle it in your code. sql is not good for this because for each individual row it apply the IF.
for date diff 13715 row effected. it's terrible. IF will disable Paging either.

Look at this:

SELECT COUNT(1) AS CNT, `user_id` FROM `discuss_posts` WHERE `user_id` IN (7075,564,6224,4273,7805,8483,543,8544,6769,6960,6235,7341,7692,476,5988,8516,8555,8130,1182,1115,403,8230,7164,7700,8328,1630,7597,7809,6227,8562,8511,1668,8547,7617,8087,8549,7760,8131,8532,8559,6928,1184,7544,8556,1450,7123,980,7391) AND `parent_id` = 0 AND `published` = 1 group by `user_id`;
# User@Host: j---- @ localhost [] Id: 18738
# Query_time: 16.452306 Lock_time: 6.582165 Rows_sent: 50 Rows_examined: 25996

Using IN is not recommended like this. you should use Temp Table and use Join instead of Where Statement IN. as you can see the IN statement kills sql.

Another bad Query:


SELECT DISTINCT( a.`id` ), a.`points` AS `total_points`, COUNT( b.`id` ) AS `total_answers`
FROM `unurc_discuss_users` AS a LEFT JOIN `unurc_discuss_posts` AS b ON a.`id` = b.`user_id`
AND b.`answered` = '1' AND b.`parent_id` != '0' INNER JOIN `unurc_users` AS c ON c.`id` = a.`id`
GROUP BY a.`id` ORDER BY total_points DESC LIMIT 0,5;

Query_time: 9.4341306

you should try to not to use LEFT JOIN. he recommend you to make table which contains Posts and UserID to omit the Left Join. in addition you are not suppose to use DISTINC and Group by.

I can see sometimes table will lock for more than 12sec, in MSSQL we can use (with nolock) parameter. we have something equal in MYSQL:
http://itecsoftware.com/with-nolock-table-hint-equivalent-for-mysql


full log in enclosed.

Thank you for cooperation.
·
Sunday, 06 July 2014 23:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Hossein,

I am really sorry for the delay of this reply as it is a weekend for us here. Can you please provide us with the phpmyadmin access to the site?
·
Monday, 07 July 2014 12:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, That's it.

Please log in to cpanel and select phpmyadmin.
·
Monday, 07 July 2014 13:31
·
0 Likes
·
0 Votes
·
0 Comments
·
subscribe
·
Tuesday, 08 July 2014 00:00
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Hossein,

I am sorry for the delay of this reply.

Thanks for the logs and the suggestion on optimising the queries. I've added some fix on your site and the sql performance should be better now
Please give it a try again
Sam
·
Tuesday, 08 July 2014 15:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Sam

Thank you for your kind help. yes it looks extremely better. the server load looks much less than before.
would you please allows us to know which modification you applied? are they apply in next version of EasyDiscuss or we should hardcode them by ourself?
·
Tuesday, 08 July 2014 16:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Hossein,

I am sorry for the delay of this reply and glad to know the fix worked

No worry, the fix will be added into next release of EasyDiscuss. By the way, below are the files I've modified.

JOOMLA/administrator/components/com_easydiscuss/tables/profile.php
JOOMLA/components/com_easydiscuss/models/posts.php
JOOMLA/modules/mod_easydiscuss_leaderboard/helper.php

I also added below db table index to speed up the queries


alter table jos_discuss_favourites add index `idx_fav_postid` (`post_id`);


Hope this help and have a nice day
Sam
·
Tuesday, 08 July 2014 16:39
·
0 Likes
·
0 Votes
·
0 Comments
·
I am also interested in this.
I would like to apply the changes aswell on our installation.
·
Tuesday, 08 July 2014 16:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mist,

Sure. Attached are the updated php files. Please download 'profile.php' and copy to folder JOOMLA/administrator/components/com_easydiscuss/tables/ and overwrite the existing profile.php. Download file 'posts.php' and copy to folder JOOMLA/components/com_easydiscuss/models/ and overwrite the existing posts.php file. If you are using leaderboard module, then download the file 'helper.php' and copy to folder JOOMLA/modules/mod_easydiscuss_leaderboard/ and overwrite the existing file helper.php. Remember to backup the original files before you overwrite with the one attached here

Next, execute below sql from your phpMyAdmin.

alter table jos_discuss_favourites add index `idx_fav_postid` (`post_id`);


Replace the jos_ to your own Joomla db table prefix

Hope this help and have a nice day
Sam
·
Tuesday, 08 July 2014 16:57
·
0 Likes
·
0 Votes
·
0 Comments
·
It seems there are some other problems, because the server load and mysql process got high. I'll gather slowquery log and provide you for further optimizations.
·
Tuesday, 08 July 2014 19:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Hossein,

Thanks for the heads up. Sure, do let me know if you found anything related to EasyDiscuss which causing the issue of yours and we will then look into the issue again.

Thanks and have a nice day
Sam
·
Wednesday, 09 July 2014 10:14
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post