RegisterRegister   SearchSearch   LoginLogin

 

BuildSmart
New Member
Joined: Dec 06, 2008
unknown
Posts: 19
Location:


MAIN page load time - serious bug.
Posted Jul 26, 2009 10:20 AM

TEST generated with original code with only path seperate '\' changed to '/'.

Tested on 3 different servers under different versions of apache.

Current info:
  1. 84 users.
  2. 66 topics.
  3. 176 posts

Logged in results:
Code: Expand  Collapse
---------------------------------------------------------------------------------- 
| Total Time  | Avg Time  | Count |                   Template                   |
---------------------------------------------------------------------------------- 
| 1808 ms     | 1808 ms   | 1     | /www/phpSITE/cf4em/index.cfm                 |
| 1808 ms     | 1808 ms   | 1     | /www/phpSITE/cf4em/cf4em.cfm                 |
| 1780 ms     | 1780 ms   | 1     | /www/phpSITE/cf4em/dsp/dsp_forums.cfm        |
| 881 ms      | 3 ms      | 258   | /www/phpSITE/cf4em/cfcs/cf4emForums.cfc      |
| 61 ms       | 1 ms      | 31    | /www/phpSITE/cf4em/cfcs/cf4emGroups.cfc      |
| 48 ms       | 1 ms      | 28    | /www/phpSITE/cf4em/cfcs/cf4emPosts.cfc       |
| 41 ms       | 41 ms     | 1     | /www/phpSITE/cf4em/dsp/dsp_forumstats.cfm    |
| 26 ms       | 26 ms     | 1     | /www/phpSITE/cf4em/frm/frm_jumper.cfm        |
| 19 ms       | 19 ms     | 1     | /www/phpSITE/cf4em/cfcs/cf4emStats.cfc       |
| 11 ms       | 2 ms      | 4     | /www/phpSITE/cf4em/cfcs/cf4em.cfc            |
| 9 ms        | 9 ms      | 1     | /www/phpSITE/cf4em/Application.cfm           |
| 8 ms        | 4 ms      | 2     | /www/phpSITE/cf4em/cfcs/cf4emUsers.cfc       |
| 5 ms        | 2 ms      | 2     | /www/phpSITE/cf4em/cfcs/cf4emPms.cfc         |
| 2 ms        | 2 ms      | 1     | /www/phpSITE/cf4em/cfcs/cf4emForumCats.cfc   |
| 1 ms        | 1 ms      | 1     | /www/phpSITE/cf4em/act/act_sessiontovars.cfm |
| 1 ms        | 0 ms      | 2     | /www/phpSITE/cf4em/inc/forumFunctions.cfm    |
| 0 ms        | 0 ms      | 1     | /www/phpSITE/cf4em/act/act_cookielogin.cfm   |
| 0 ms        | 0 ms      | 1     | /www/phpSITE/cf4em/inc/cf4em_config.cfm      |
| 0 ms        |  
---------------------------------------------------------------------------------- 
| 1828 ms. TOTAL EXECUTION TIME                                                  |
----------------------------------------------------------------------------------


Not Logged in results:
Code: Expand  Collapse
----------------------------------------------------------------------------------
| Total Time  | Avg Time  | Count |                   Template                   |
----------------------------------------------------------------------------------
| 122505 ms   | 122505 ms | 1     | /www/phpSITE/cf4em/index.cfm                 |
| 122505 ms   | 122505 ms | 1     | /www/phpSITE/cf4em/cf4em.cfm                 |
| 122452 ms   | 122452 ms | 1     | /www/phpSITE/cf4em/dsp/dsp_forums.cfm        |
| 121174 ms   | 121174 ms | 1     | /www/phpSITE/cf4em/dsp/dsp_forumstats.cfm    |
| 120111 ms   | 120111 ms | 1     | /www/phpSITE/cf4em/cfcs/cf4emStats.cfc       |
| 839 ms      | 3 ms      | 258   | /www/phpSITE/cf4em/cfcs/cf4emForums.cfc      |
| 115 ms      | 4 ms      | 28    | /www/phpSITE/cf4em/cfcs/cf4emPosts.cfc       |
| 94 ms       | 3 ms      | 29    | /www/phpSITE/cf4em/cfcs/cf4emGroups.cfc      | 
| 48 ms       | 48 ms     | 1     | /www/phpSITE/cf4em/frm/frm_jumper.cfm        |
| 40 ms       | 10 ms     | 4     | /www/phpSITE/cf4em/cfcs/cf4em.cfc            |
| 33 ms       | 33 ms     | 1     | /www/phpSITE/cf4em/Application.cfm           |
| 17 ms       | 17 ms     | 1     | /www/phpSITE/cf4em/cfcs/cf4emForumCats.cfc   |
| 12 ms       | 6 ms      | 2     | /www/phpSITE/cf4em/cfcs/cf4emUsers.cfc       |
| 10 ms       | 5 ms      | 2     | /www/phpSITE/cf4em/inc/forumFunctions.cfm    |
| 3 ms        | 3 ms      | 1     | /www/phpSITE/cf4em/act/act_sessiontovars.cfm |
| 2 ms        | 2 ms      | 1     | /www/phpSITE/cf4em/inc/cf4em_config.cfm      |
| 0 ms        | 0 ms      | 1     | /www/phpSITE/cf4em/act/act_cookielogin.cfm   |
----------------------------------------------------------------------------------
| 122542 ms TOTAL EXECUTION TIME                                                 |
----------------------------------------------------------------------------------


From what I can tell, it looks like there is a problem with 'cfcs/cf4emStats.cfc' or 'dsp/dsp_forumstats.cfm' if you are not logged in.

I've timed the MySQL queries to log and they all execute almost instantly.

Query with longest time/results:
Code: Expand  Collapse
select
				u.userid		as lastpostuserid
		,		u.username		as lastpostusername
		,		p.dateadded		as lastpostpostdate
		,		p.postid 		as lastpostpostid
		,		p.posttitle		as lastpostposttitle
		,		p.threadid 		as lastpostthreadid
		,		t.threadtitle	as lastpostthreadtitle
		,		t.forumid 		as lastpostforumid
from
				cf4em_users 	u
		,		cf4em_posts 	p
		,		cf4em_threads 	t
		,		cf4em_forums 	f		
where
				u.userid = p.userid 
		and		t.threadid = p.threadid
		and		t.forumid = f.forumid
		and		f.adminonly = NULL or f.adminonly = 0

Results: Returned 675744 total, Query took 9.1049 secs.

« Last edit: Aug 1, 2009 5:29 PM by BuildSmart»

Profile  PM 


Quote

BuildSmart
New Member
Joined: Dec 06, 2008
unknown
Posts: 19
Location:


Re: MAIN page load time - serious bug.
Posted Aug 1, 2009 5:21 PM

This cannot be correct, this must be an error, the amount of data being returned increases exponentially based on the number of posts and the numbers of users.

No new posts added, 5 new users added and times/results are getting out of hand.

I also see the same problem happening with this forum as more posts are added so there is definitely a problem that needs to be resolved.

By enclosing a portion of the query data in brackets to isolate the or statment it reduces the results/time but I'm not sure this is the intended results since it returns only 1 result.

QUERY: (as provided)
Code: Expand  Collapse
select
			u.userid		as lastpostuserid
	,		u.username		as lastpostusername
	,		p.dateadded		as lastpostpostdate
	,		p.postid 		as lastpostpostid
	,		p.posttitle		as lastpostposttitle
	,		p.threadid 		as lastpostthreadid
	,		t.threadtitle	as lastpostthreadtitle
	,		t.forumid 		as lastpostforumid
from
			cf4em_users 	u
	,		cf4em_posts 	p
	,		cf4em_threads 	t
	,		cf4em_forums 	f		
where
			u.userid = p.userid 
	and		t.threadid = p.threadid
	and		t.forumid = f.forumid
	and		f.adminonly = NULL or f.adminonly = 0
order by
	p.dateadded desc

Results: Returned 1033824 total, Query took 16.8763 secs.

QUERY: (modified)
Code: Expand  Collapse
select
			u.userid		as lastpostuserid
	,		u.username		as lastpostusername
	,		p.dateadded		as lastpostpostdate
	,		p.postid 		as lastpostpostid
	,		p.posttitle		as lastpostposttitle
	,		p.threadid 		as lastpostthreadid
	,		t.threadtitle	as lastpostthreadtitle
	,		t.forumid 		as lastpostforumid
from
			cf4em_users 	u
	,		cf4em_posts 	p
	,		cf4em_threads 	t
	,		cf4em_forums 	f		
where
			u.userid = p.userid 
	and		t.threadid = p.threadid
	and		t.forumid = f.forumid
	and		(f.adminonly = NULL or f.adminonly = 0)
order by
	p.dateadded desc

Results: Returned 1 total, Query took 0.0005 secs.

QUERY: (without adminonly check)
Code: Expand  Collapse
select
			u.userid		as lastpostuserid
	,		u.username		as lastpostusername
	,		p.dateadded		as lastpostpostdate
	,		p.postid 		as lastpostpostid
	,		p.posttitle		as lastpostposttitle
	,		p.threadid 		as lastpostthreadid
	,		t.threadtitle	as lastpostthreadtitle
	,		t.forumid 		as lastpostforumid
from
			cf4em_users 	u
	,		cf4em_posts 	p
	,		cf4em_threads 	t
	,		cf4em_forums 	f		
where
			u.userid = p.userid 
	and		t.threadid = p.threadid
	and		t.forumid = f.forumid
order by
	p.dateadded desc

Results: Returned 176 total, Query took 0.0029 secs.

I don't believe these are the intended results but since it's unclear what is being sought it's hard to correct the QUERY to provide the required results.

In the context of it's use, I think that the QUERY should return only 1 results regardless of admin or non admin user and this does seem to hold true by encapsulating the check but the query could stand to use some additional work if it should return only 1 query regardless of user status.

« Last edit: Aug 1, 2009 5:28 PM by BuildSmart»

Profile  PM 


Quote

BuildSmart
New Member
Joined: Dec 06, 2008
unknown
Posts: 19
Location:


Re: MAIN page load time - serious bug.
Posted Aug 2, 2009 2:06 AM

After further examination, I have concluded that the adminonly field default should be 0 and not NULL.

I changed the structure of adminonly (from cf4em_forums) and this provided a more uniformed response and allowed the query to be changed to 'and f.adminonly = 0'.

This reduced any chance of cross contamination and returned all the posts in the required date post order.

QUERY: (current)
Code: Expand  Collapse
select
			u.userid		as lastpostuserid
	,		u.username		as lastpostusername
	,		p.dateadded		as lastpostpostdate
	,		p.postid 		as lastpostpostid
	,		p.posttitle		as lastpostposttitle
	,		p.threadid 		as lastpostthreadid
	,		t.threadtitle		as lastpostthreadtitle
	,		t.forumid 		as lastpostforumid
from
			cf4em_users 	u
	,		cf4em_posts 	p
	,		cf4em_threads 	t
	,		cf4em_forums 	f		
where
			u.userid = p.userid 
	and		t.threadid = p.threadid
	and		t.forumid = f.forumid
	<!--- if the user is NOT an admin, dont show the latest post from admin only forums --->
	<cfif NOT arguments.isadmin>
	<!--- FIXED bug #BR0005 and added 'Admin only' option to forum creation/updating form --->
	and		f.adminonly = 0
	</cfif>
order by
	p.dateadded desc

Results: Returned 176 total, Query took 0.0021 secs.

« Last edit: Aug 2, 2009 2:11 AM by BuildSmart»

Profile  PM 


Quote


  New Topic  Reply