We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

slow slow slow Plz help me out | Forum

Topic location: Forum home » Support » General Questions
Jordi
Jordi Feb 12 '16
My website is running on a 5 x cpu 8GB VPS ( centos ) 

But loading the newsfeed is taking so long (sometimes more then 15 seconds ).

How can i solve this?


this is the query that takes so long


# Time: 160210 21:41:44# User@Host: XXXXXXX @ localhost []# Query_time: 26.482464  Lock_time: 0.001632 Rows_sent: 5  Rows_examined: 89231SET timestamp=1455136904;SELECT  b.`id` FROM            ( SELECT  action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM ow_newsfeed_action action            INNER JOIN ow_newsfeed_activity activity ON action.id = activity.actionId            INNER JOIN `ow_newsfeed_action_set` cactivity ON action.id = cactivity.actionId            INNER JOIN `ow_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `ow_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` LEFT JOIN `ow_base_user_disapprove` base_user_approve_table_alias ON base_user_approve_table_alias.`userId` = `base_user_table_alias`.`id`            INNER JOIN ow_newsfeed_action_feed action_feed ON activity.id=action_feed.activityId            LEFT JOIN ow_newsfeed_follow follow ON action_feed.feedId = follow.feedId AND action_feed.feedType = follow.feedType            WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND (`base_user_approve_table_alias`.`id` IS NULL) AND (`base_user_table_alias`.`emailVerify` = 1) AND cactivity.userId = 2 AND activity.status='active' AND activity.timeStamp<1455136876 AND (                    ( follow.userId=2 AND activity.visibility & 2 ) )
            UNION
            SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM ow_newsfeed_action action                INNER JOIN ow_newsfeed_activity activity ON action.id = activity.actionId                INNER JOIN `ow_newsfeed_action_set` cactivity ON action.id = cactivity.actionId                INNER JOIN `ow_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `ow_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` LEFT JOIN `ow_base_user_disapprove` base_user_approve_table_alias ON base_user_approve_table_alias.`userId` = `base_user_table_alias`.`id`                WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND (`base_user_approve_table_alias`.`id` IS NULL) AND (`base_user_table_alias`.`emailVerify` = 1) AND cactivity.userId = 2 AND activity.status='active' AND activity.timeStamp<1455136876 AND (                        ( activity.userId=2 AND activity.visibility & 4 ) )
            UNION
            SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM ow_newsfeed_action action                INNER JOIN ow_newsfeed_activity activity ON action.id = activity.actionId                INNER JOIN `ow_newsfeed_action_set` cactivity ON action.id = cactivity.actionId                INNER JOIN `ow_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `ow_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` LEFT JOIN `ow_base_user_disapprove` base_user_approve_table_alias ON base_user_approve_table_alias.`userId` = `base_user_table_alias`.`id`                INNER JOIN ow_newsfeed_action_feed action_feed ON activity.id=action_feed.activityId                WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND (`base_user_approve_table_alias`.`id` IS NULL) AND (`base_user_table_alias`.`emailVerify` = 1) AND cactivity.userId = 2 AND activity.status='active' AND activity.timeStamp<1455136876                AND ( ( action_feed.feedId=2 AND action_feed.feedType="user" AND activity.visibility & 8 ) )
            UNION
            SELECT action.`id`, action.`entityId`, action.`entityType`, action.`pluginKey`, action.`data`, activity.timeStamp FROM ow_newsfeed_action action                INNER JOIN ow_newsfeed_activity activity ON action.id = activity.actionId                INNER JOIN `ow_newsfeed_action_set` cactivity ON action.id = cactivity.actionId                INNER JOIN `ow_base_user` base_user_table_alias ON base_user_table_alias.`id` = `cactivity`.`userId` LEFT JOIN `ow_base_user_suspend` base_user_suspend_table_alias ON base_user_suspend_table_alias.`userId` = `base_user_table_alias`.`id` LEFT JOIN `ow_base_user_disapprove` base_user_approve_table_alias ON base_user_approve_table_alias.`userId` = `base_user_table_alias`.`id`                INNER JOIN ow_newsfeed_activity subscribe ON activity.actionId=subscribe.actionId and subscribe.activityType='subscribe' AND subscribe.userId=2                WHERE (`base_user_suspend_table_alias`.`id` IS NULL) AND (`base_user_approve_table_alias`.`id` IS NULL) AND (`base_user_table_alias`.`emailVerify` = 1) AND cactivity.userId = 2 AND activity.status='active' AND activity.timeStamp<1455136876
                ) b
            GROUP BY b.`id` ORDER BY MAX(b.timeStamp) DESC LIMIT 0, 5;


tammy harris
tammy harris Feb 12 '16
use a cache like xcacher
and 5 x cpu 8GB VPS
look at the server and how much of that is uses
tune your sql server will help you lots
Jordi
Jordi Feb 12 '16
HOw can i tune it tammy? 
tammy harris
tammy harris Feb 12 '16
http://mysqltuner.com/

and

https://mediatemple.net/community/products/dv/204643230/using-mysqltuner


ross Team
ross Feb 15 '16
Jordi, read my reply here: http://www.oxwall.org/forum/topic/29251?page=1#post-125577 and here: 

http://www.oxwall.org/forum/topic/31141

The Forum post is edited by ross Feb 15 '16