Author |
Topic  |
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 17 June 2002 : 05:49:58
|
quote:
Remove many of the GetMemberID calls and replace them with MemberId to Ruirib that helps a lot also.
www.daoc-halo.com
In fact there are many GetMemberId calls, but all of them are related to inc_jump_to.asp, except one at the beginning. This one at the beggining is rather surprising, because the call is made during an assignment
Member_Id = getNewMemberID()
and in inc_top.asp the variable MemberId is already defined and has the needed value. Replacing Member_ID with MemberID will save you an extra DB call, but must be done carefully, because "Member_Id" is also used to get a value from a recordset and obviously it cannot be replaced. This was the change referred by me in my last post.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 17 June 2002 : 08:20:04
|
quote:
I have ~50,000 active posts, the rest are archived. I will try ruirib's modification now.
Pop Up Times Webmaster http://www.popuptimes.com
You can also remove the inc_jump_to.asp include from active.asp
All together these removals will spare you a healthy number of DB calls, at a small usability cost (I hardly use that drop-down..).
Anyway I'll have a look at building the drop-down with a reduced number of DB calls.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 17 June 2002 : 08:59:45
|
getNewMemberNumber, and getMemberNumber and getMemberId in inc_functions could all have the following code placed right at the top
if MemberID <> 0 then getNewMemberNumber = MemberID exit function end if
The Variable MemberId is already being set in inc_top.asp to equal the current user. you'll need to change getNewMemberNumber to GetMemberNumber and GetMemberID for the respective functions.
Just saves another call here and there.
If you carefully read through the post that was linked at the start of this one you'll find all the changes you need to make to get your forum down to around 8-10 calls per page.
www.daoc-halo.com
Edited by - Gremlin on 17 June 2002 09:00:27 |
 |
|
aiken
Starting Member
28 Posts |
Posted - 19 July 2002 : 13:20:30
|
I recently ran into the inc_jump_to issue; after tons of customization and moving pretty much all queries to stored procedures, forum pages were slow to load. Investigation showed that I had topic.asp down to .6 seconds up until inc_jump_to, which then added 5-7 seconds. Ouch! Modified, inc_jump_to.asp is taking less than .2 second now.
Further improvement is possible by adding the data needed for ChkForumAccess to the stored procedure and then creating a modified ChkForumAccess ("ChkForumAccessFast") which takes the data as parameters rather than looking it up in a seperate query. I've done that with CheckSubscription and it's made a pretty significant difference in forum.asp load times.
Here's my rewritten inc_jump_to.asp; it uses a stored procedure but it would be easy to convert to a plain old text query.
p_snitz_JumpTo:CREATE PROCEDURE p_snitz_JumpTo AS set nocount on select SNITZ_CATEGORY.CAT_ID, CAT_NAME, CAT_ORDER,FORUM_ID,F_SUBJECT,F_ORDER,F_TYPE,F_URL FROM SNITZ_CATEGORY WITH(NOLOCK) JOIN SNITZ_FORUM WITH(NOLOCK) ON SNITZ_FORUM.CAT_ID=SNITZ_CATEGORY.CAT_ID ORDER BY CAT_ORDER ASC, CAT_NAME ASC,F_ORDER ASC,F_SUBJECT ASC GO
inc_jump_to.asp:<% '################################################################################# '## Copyright (C) 2000-01 Michael Anderson and Pierre Gorissen '## '## This program is free software; you can redistribute it and/or '## modify it under the terms of the GNU General Public License '## as published by the Free Software Foundation; either version 2 '## of the License, or any later version. '## '## All copyright notices regarding Snitz Forums 2000 '## must remain intact in the scripts and in the outputted HTML '## The "powered by" text/logo with a link back to '## http://forum.snitz.com in the footer of the pages MUST '## remain visible when the pages are viewed on the internet or intranet. '## '## This program is distributed in the hope that it will be useful, '## but WITHOUT ANY WARRANTY; without even the implied warranty of '## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '## GNU General Public License for more details. '## '## You should have received a copy of the GNU General Public License '## along with this program; if not, write to the Free Software '## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. '## '## Support can be obtained from support forums at: '## http://forum.snitz.com '## '## Correspondence and Marketing Questions can be sent to: '## reinhold@bigfoot.com '## '## or '## '## Snitz Communications '## C/O: Michael Anderson '## PO Box 200 '## Harpswell, ME 04079 '################################################################################# Response.Write "<!-- START JUMP TO -->" & vbNewline Response.Write " <form name=""Stuff"">" Response.Write " <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & _ """><b>Jump To:</b></font>" & vbNewline Response.Write " <select name=""SelectMenu"" size=""1"" onchange=""jumpTo(this)"">" & vbNewline & _ " <option value=""./"">Select Forum</option>" & vbNewline '## Get all Forum Categories From DB Set cmdCat=Server.CreateObject("ADODB.Command") cmdCat.ActiveConnection=my_Conn cmdCat.CommandType=adCmdStoredPRoc cmdCat.CommandText="dbo.p_snitz_JumpTo" Set rsCat=Server.CreateObject("ADODB.RecordSet") rsCat.Open cmdCat,,adOpenForwardOnly,adLockReadOnly Set cmdCat=nothing
iOldCat = 0 do until rsCat.eof '## Grab the Categories. CatID = rsCat("CAT_ID") CatName = rsCat("CAT_NAME") ForumCatID = rsCat("CAT_ID") ForumID = rsCat("FORUM_ID") ForumType = rsCat("F_TYPE") ForumURL = rsCat("F_URL") if ChkForumAccess(ForumID, getNewMemberNumber()) then if CatID <> iOldCat Then Response.Write " <option value='/forums/default.asp'>" & CatName & "</option>" & vbNewline iOldCat = CatID end if if ForumType = 0 then Response.Write " <option value='" & MakeForumURL(ForumID,"","") & "'" elseif ForumType = 1 then Response.Write " <option value='" & ForumURL & "'" end if if ForumID = Request.Querystring("Forum_ID") then Response.Write(" SELECTED") end if Response.Write "> " & rsCat("F_SUBJECT")& "</option>" & vbNewline end if rsCat.MoveNext loop rsCat.Close Set rsCat=nothing Response.Write " <option value=""""> --------------------</option>" & vbNewline & _ " <option value=""" & strHomeURL & """>Home</option>" & vbNewline & _ " <option value=""active.asp"">Active Topics</option>" & vbNewline & _ " <option value=""faq.asp"">Frequently Asked Questions</option>" & vbNewline & _ " <option value=""members.asp"">Member Information</option>" & vbNewline & _ " <option value=""search.asp"">Search Page</option>" & vbNewline & _ " </select>" & vbNewline & _ "</form>" & vbNewline & _ "<!-- END JUMP TO -->" & vbNewline %>
Cheers -b
Edited by - aiken on 19 July 2002 13:23:59 |
 |
|
aiken
Starting Member
28 Posts |
Posted - 19 July 2002 : 14:12:30
|
Here's one more easy way to speed up default.asp and reduce the number of queries it uses to build the page. I'm using the getrows mod and have further modified that mod, so it may not be exact but it should be pretty easy to figure out. The problem is that default.asp calls "listmoderators" twice; once to see if there are any, and then again if there are. Ugh.
Original (around like 385; my forum is modified so that's not exact):if (listForumModerators(allForumData(0, iForum)) <> "") then Response.Write listForumModerators(allForumData(0, iForum)) & vbNewline else Response.Write " " & vbNewline end if
Fixed:
szModerators=listForumModerators(allForumData(0, iForum) if szModerators<>"" Then Response.Write szModerators & vbNewline Else Response.Write " " & vbNewline End If
Of course, the superior way all around is to just return the list of moderators with the forum data rather than doing an additional round trip for each forum. I've implented that, and it should be pretty easy for people using getrows to follow. First, there's the stored procedure for getting all of the forums. That SP uses a UDF to get a moderator list as part of its return (it also gets the user's subscription status, but that's a bigger mod than I want to get into documenting right now).
p_snitz_GetForums CREATE PROCEDURE p_snitz_GetForums (@iUsers int=0) AS set nocount on SELECT SNITZ_FORUM.FORUM_ID, SNITZ_FORUM.F_STATUS, SNITZ_FORUM.CAT_ID, SNITZ_FORUM.F_SUBJECT, SNITZ_FORUM.F_URL, SNITZ_FORUM.F_DESCRIPTION, SNITZ_FORUM.F_TOPICS, SNITZ_FORUM.F_COUNT, SNITZ_FORUM.F_LAST_POST, SNITZ_FORUM.F_TYPE, SNITZ_FORUM.F_ORDER, SNITZ_FORUM.F_PRIVATEFORUMS, SNITZ_FORUM.F_A_COUNT, SNITZ_FORUM.F_SUBSCRIPTION, SNITZ_MEMBERS.MEMBER_ID, SNITZ_MEMBERS.M_NAME,IsNull(SUBSCRIPTION_ID,0) as Forum_Sub,IsNull(dbo.f_snitz_ListModerators(SNITZ_FORUM.FORUM_ID),'') as Moderators FROM SNITZ_FORUM WITH(NOLOCK) LEFT JOIN SNITZ_MEMBERS WITH(NOLOCK) ON SNITZ_FORUM.F_LAST_POST_AUTHOR = SNITZ_MEMBERS.MEMBER_ID LEFT JOIN SNITZ_SUBSCRIPTIONS WITH(NOLOCK) ON SNITZ_SUBSCRIPTIONS.FORUM_ID=SNITZ_FORUM.FORUM_ID AND SNITZ_SUBSCRIPTIONS.TOPIC_ID=0 AND SNITZ_SUBSCRIPTIONS.MEMBER_ID=@iUsers
ORDER BY SNITZ_FORUM.F_ORDER ASC, SNITZ_FORUM.F_SUBJECT ASC GO
dbo.f_snitz_ListModerators CREATE FUNCTION dbo.f_snitz_ListModerators (@iForums int) RETURNS varchar(255) AS BEGIN DECLARE @vcModList varchar(255)
SELECT @vcModList=COALESCE(@vcModList + ', ','')+SNITZ_MEMBERS.M_NAME FROM SNITZ_MODERATOR WITH (NOLOCK) LEFT OUTER JOIN SNITZ_MEMBERS WITH (NOLOCK) ON SNITZ_MODERATOR.MEMBER_ID=SNITZ_MEMBERS.MEMBER_ID WHERE SNITZ_MODERATOR.FORUM_ID=@iForums
return @vcModList END
default.asp, around line 385 Old:
if (listForumModerators(allForumData(0, iForum)) <> "") then Response.Write listForumModerators(allForumData(0, iForum)) & vbNewline else Response.Write " " & vbNewline end if
New: if (allForumData(17,iForum) <> "") then Response.Write allForumData(17, iForum) & vbNewline else Response.Write " " & vbNewline end if
Cheers -b
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
|
aiken
Starting Member
28 Posts |
Posted - 20 July 2002 : 13:22:28
|
Thanks; I have a ton more -- my forums are almost 100% stored procedures and getrows, with numerous performance improvements. However, at the same time I was doing that work I was modifying them for better integration with a website and user database. I'd be happy to contribute all of my SP's and code modifications, but someone would have to modify them back to fit a "stock" snitz installation.
Cheers -b
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 20 July 2002 : 13:37:36
|
quote:
Thanks; I have a ton more -- my forums are almost 100% stored procedures and getrows, with numerous performance improvements. However, at the same time I was doing that work I was modifying them for better integration with a website and user database. I'd be happy to contribute all of my SP's and code modifications, but someone would have to modify them back to fit a "stock" snitz installation.
Well that's a generous offer, thank you for that. Anyhow 3.4 is very near release and it will bring some major performance improvements and DB call reduction. It's probably wiser to wait for it and see what needs to be done afterwards, if anything. At least doing a stored procedure version for 3.4 looks like something that could be interesting, and doing it very soon after it comes out can ensure a high longevity to it, I think.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
 |
|
Gremlin
General Help Moderator
    
New Zealand
7528 Posts |
Posted - 20 July 2002 : 18:54:01
|
I'd be very interested in having a look at the SP work you've done, there would be no need to modify it back to "Snitz standard" as my forums aren't anywhere near standard.
www.daoc-halo.com |
 |
|
Topic  |
|
|
|