Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP Processing - Performance Issues

Reply
Thread Tools

ASP Processing - Performance Issues

 
 
JP SIngh
Guest
Posts: n/a
 
      07-29-2005
Hi All

Just wondering if you anyone can give me some tips on speeding up the asp
page which has about 50 fields and 10 drop downs.

The page loads up very slowly.

Also I have couple of questions in relation to the performance of ASP Pages

1. I open up the SQL Server connection in a file call dbconn.asp

set conn = server.createobject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA
SOURCE=MYSQLSRV;UID=User;PWD=SQLPa55;DATABASE=NEWD B"

and include this file on top of every page.

Is this a good practice? Or shall I be open the connection on every page and
closing it on the page itself.

2. The page has 10 dropdowns menus each of which can have about 500 odd
records. Is there an alternative design solution so i don't have to open up
11 recordsets 1 for the main page and 10 for the drop downs.

Thanks in advance for your help

Regards


 
Reply With Quote
 
 
 
 
McKirahan
Guest
Posts: n/a
 
      07-29-2005
"JP SIngh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All
>
> Just wondering if you anyone can give me some tips on speeding up the asp
> page which has about 50 fields and 10 drop downs.
>
> The page loads up very slowly.
>
> Also I have couple of questions in relation to the performance of ASP

Pages
>
> 1. I open up the SQL Server connection in a file call dbconn.asp
>
> set conn = server.createobject("ADODB.Connection")
> conn.open "PROVIDER=SQLOLEDB;DATA
> SOURCE=MYSQLSRV;UID=User;PWD=SQLPa55;DATABASE=NEWD B"
>
> and include this file on top of every page.
>
> Is this a good practice? Or shall I be open the connection on every page

and
> closing it on the page itself.
>
> 2. The page has 10 dropdowns menus each of which can have about 500 odd
> records. Is there an alternative design solution so i don't have to open

up
> 11 recordsets 1 for the main page and 10 for the drop downs.
>
> Thanks in advance for your help
>
> Regards



Are the contents of the drop-downs relatively static?

You could pre-build and store them in application variables in the
global.asa.

Hava a separate page than rebuilds the variables whenever the data changes.


 
Reply With Quote
 
 
 
 
John Blessing
Guest
Posts: n/a
 
      07-29-2005
"JP SIngh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All
>
> Just wondering if you anyone can give me some tips on speeding up the asp
> page which has about 50 fields and 10 drop downs.
>
> The page loads up very slowly.
>
> Also I have couple of questions in relation to the performance of ASP
> Pages
>
> 1. I open up the SQL Server connection in a file call dbconn.asp
>
> set conn = server.createobject("ADODB.Connection")
> conn.open "PROVIDER=SQLOLEDB;DATA
> SOURCE=MYSQLSRV;UID=User;PWD=SQLPa55;DATABASE=NEWD B"
>
> and include this file on top of every page.
>
> Is this a good practice? Or shall I be open the connection on every page
> and
> closing it on the page itself.



No it is not good pracitce. Only open it when you need a connection to the
database and close it asap.You can keep the connection string in an include
file though, that way you only need to change it in one place. Or you could
build a wrapper function for the connection and recordset opens, and have
that in an include file, but never leave connections open when you don't
need them.

Also, you might find that using the server's IP address in the connection is
quicker than using its name

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-30-2005
JP SIngh wrote:
> Hi All
>
> Just wondering if you anyone can give me some tips on speeding up the
> asp page which has about 50 fields and 10 drop downs.
>
> The page loads up very slowly.
>
> Also I have couple of questions in relation to the performance of ASP
> Pages
>
> 1. I open up the SQL Server connection in a file call dbconn.asp
>
> set conn = server.createobject("ADODB.Connection")
> conn.open "PROVIDER=SQLOLEDB;DATA
> SOURCE=MYSQLSRV;UID=User;PWD=SQLPa55;DATABASE=NEWD B"
>


ahem, I hope these aren't really the uid and pwd for your database ...

> and include this file on top of every page.
>
> Is this a good practice? Or shall I be open the connection on every
> page and closing it on the page itself.


The second. See John's reply.
As to whether the IP or the server name is "quicker" I doubt that this is
the bottleneck.

>
> 2. The page has 10 dropdowns menus each of which can have about 500
> odd records. Is there an alternative design solution so i don't have
> to open up 11 recordsets 1 for the main page and 10 for the drop
> downs.
>


Caching is the obvious answer. How often do the options in the selects
change? Do you really need to go back to the database for them every time?
You can use Application, Session, or even local files to cache the options
and avoid the trip to the database. I often use this technique for static
lists:

RegionDropDown.asp:
<%
Function RegionDropdown(pName, pDefault,pAllowAll)
dim cn,rs,strsql,sOptions, sHTML, i
sHTML=Application("Reg_HTML")
if len(sHTML) = 0 then
set cn = createobject("ADODB.CONNECTION")
set rs=CreateObject("adodb.recordset")
cn.open "provider=xx;data source=xx;user id=xx;password=xx"

strsql="SELECT DISTINCT " & _
"'<OPTION value=""' + CAST(RegionID AS varchar(2))" & _
" + '"">' + RegDesc + '</option>' as [option] " & _
"FROM dbo.COMPANYREGION " & _
"ORDER BY [option]"

set rs = cn.Execute(strsql,,1)
if not rs.eof then sOptions= rs.GetString(,,"",vbCrLf)
rs.Close:set rs=nothing
cn.Close:set cn=nothing
'Response.Write sOptions
sHTML="<SELECT style=""font-family:Lucida Console"">" & _
vbCrLf & sOptions & vbCrLf & "</SELECT>"

'cache the results
Application("Reg_HTML")=sHTML
end if

'Insert the name of the dropdown:
sHTML=replace(sHTML,"<SELECT", _
"<SELECT name=""" & pName & """")

if pAllowAll then
if InStr(sHTML,"value=""ALL""") = 0 then
i=instr(sHTML,"<OPT")
if i>0 then
sHTML=left(sHTML,i-1) & _
"<OPTION value=""ALL"">ALL</OPTION>" & vbCrLf & _
mid(sHTML,i)
end if
end if
elseif InStr(sHTML,"""ALL""") > 0 then
sHTML=replace(sHTML, _
"<OPTION value=""ALL"">ALL</OPTION>" & vbCrLf,"")
end if
if len(pDefault) > 0 then
if InStr(sHTML,pDefault & """ SELECTED") = 0 then
sHTML=replace(sHTML," SELECTED","")
sHTML=replace(sHTML,"value=""" & pDefault & """>", _
"value=""" & pDefault & """ SELECTED>")
end if
else
if InStr(sHTML," SELECTED") > 0 then
sHTML=replace(sHTML," SELECTED","")
end if
end if
RegionDropdown=sHTML
end function
%>

In the page where I want a Region dropdown:

<!--#include virtual="/scripts/RegionDropDown.asp"-->
<html><body><form ... >
....
<%=RegionDropdown("P1","01",false)%>
....
</form></body></html>

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IIS 6 vs IIS 5 ASP.NET Performance Issues JMaelstrom ASP .Net 2 04-30-2010 04:32 PM
Performance issues with ASP.NET web application - Slow response Ram ASP .Net 6 11-13-2007 01:35 AM
Post-Processing RAW vs Post-Processing TIFF Mike Henley Digital Photography 42 01-30-2005 08:26 AM
Question: processing HTML, re-write default processing action of many tags Hubert Hung-Hsien Chang Python 2 09-17-2004 03:10 PM
Performance Issues / ASP.NET smoody ASP .Net 4 02-20-2004 09:13 PM



Advertisments