Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Faster load time in asp 1

Status
Not open for further replies.

btween

Programmer
Aug 7, 2003
338
0
0
US
I have a page that loads a recordset of about 200 employee records and it takes about 20 seconds to load. Isn't there a way to load part of the records display them and load more so the browser doesn't have to stare at a blank screen?

thanks
 
Response.Flush

I'm pretty sure there's a problem using Flush for what you're asking. I use it to put up a "Processing..." message, then replace it with a "Complete" or "Error" message when carrying out lenghty tasks.
 
If you are using tables, try also <table style='table-layout: fixed;' ...>.
 
The table layout fixed seems to work except that it's messing up some rows. Are there some limitations to a table's properties when using fixed?

thanks
 
I'm having trouble with the 20 seconds part...I have 4000+ size recordsets that can be processed, streamed to client, and displayed in less. You may want to check some of the efficiency posts in the FAQs section, as well as the post here in the last day or so about speeding up pages. It's possible you could speed the system up by several more factors.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
With table-layout: fixed browser analyzes only first row, takes column widths and apply them to the rest of table. This speeds up rendering, especially on larger tables. But if column widths for first row aren't specified... you got the picture. Just specify column widths once (TH tags or COLGROUP/COL section is logical place to do that).

Btw. this only gives illusion of faster loading (aka: shorter beginning of response). 20 seconds for 200 employees is too slow IMO... problem is probably somewhere in queries/database code.
 
mey Mr3putt, can you post an example of how you use that response.flush to replace a msg on screen? thanks
 
This is my first time working with sql server, and I have been reading about stored procedures. can a stored procedure be used to populate a recordset. if yes would this speed up the client's navigation speed?

thanks
 
Yes stored procedures can be used to populate a recordset - but don't use them ASAP. Better show us ASP code that SELECTs employee records and renders data into HTML table.
 
well,

it's a standard recordset:

<%
set rsEmployees = Server.CreateObject("ADODB.Recordset")
rsEmployees.ActiveConnection = MM_premiereconn1_STRING
rsEmployees.Source = "SELECT * FROM Employees ORDER BY emp_last_name"
rsEmployees.CursorType = 0
rsEmployees.CursorLocation = 2
rsEmployees.LockType = 3
rsEmployees.Open()
rsEmployees_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 80
Dim Repeat1__index
Repeat1__index = 0
rsEmployees_numRows = rsEmployees_numRows + Repeat1__numRows
%>

the part that displays the data:

<%
While ((Repeat1__numRows <> 0) AND (NOT rsEmployees.EOF))
%>
<tr bgcolor="#FFFFFF">
<td width="7%"><a href="newemployee.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "emp_id=" & rsEmployees.Fields.Item("emp_id").Value %>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(rsEmployees.Fields.Item("emp_id").Value)%></font></a></td>
<td width="22%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><A HREF="newemployee.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "emp_id=" & rsEmployees.Fields.Item("emp_id").Value %>"><%=(rsEmployees.Fields.Item("emp_first_name").Value)%>&nbsp;<%=(rsEmployees.Fields.Item("emp_last_name").Value)%></A></font></td>
<td width="20%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=(rsEmployees.Fields.Item("emp_phone_1").Value)%></font></td>
<td width="20%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%=(rsEmployees.Fields.Item("emp_phone_2").Value)%></font></td>
<td width="24%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=(rsEmployees.Fields.Item("emp_cellphone").Value)%></font></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsEmployees.MoveNext()
Wend
%>

I want to put 100 employees per page but I don't want the client to have to wait. When I used the fixed width property it seemed to display records right away but 2 of my rows on the main encompassing table were getting messed up. This is the code for the 2 rows:

<tr bgcolor="#666666" bordercolor="#FFFFFF">
<td colspan="5" height="10"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font color="DCDCDC" face="Arial, Helvetica, sans-serif" size="4">Database
Sections &gt;&gt;&nbsp;&nbsp;</font><font face="Arial, Helvetica, sans-serif" size="4" color="DCDCDC"></font><font face="Arial, Helvetica, sans-serif" size="4">&nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><font color="#FFFFFF">&nbsp;&nbsp;<a href="employees.asp"><font color="DCDCDC">Employees</font></a><font color="DCDCDC">&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="jobs.asp"><font color="DCDCDC">Jobs</font></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Customers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vendors
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reports</font></b></font></td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF" height="10">
<p><font face="Arial, Helvetica, sans-serif" size="3"><a href="ADMIN.ASP"><font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="2">ADMIN</font></b></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="employees.asp">view
all employees</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="insemployee.asp">insert
new employee</a></font></p>
</td>
</tr>

If you guys have additional suggestions on how to speed things up or maybe I can just use the fixed width property if I can get thos rows to display correctly.

thanks
 
Got a little bit confused here... the part that displays data and first two rows are the same table? If true, split data part into separated table and apply fixed layout on it.

Unless there are bazillion employees in database, this query should fly. How quickly page stops if you write Response.End after rsEmployees.open() ?

Btw. there is too much (Dreamweaver? UltraDev?) HTML cr@p here... simple CSS can cut generated HTML to 1/3 in size.

And... no need to write = rsEmployees.Fields.Item("blah").value... = rsEmployees("blah") is enough.
 
I split it up into 2 tables and that worked. thanks

Also the response end came about 1.4 seconds after the opening of the recordset.
 
OK then... problem isn't in slow query - forget about stored procedures.

I'm stil curious... did you get 20 seconds over slow connection or LAN/local machine?
 
It was more like 14 seconds. I'm running time warner cable through a firewall. I'm building a huge Intranet and trying to figure out the most efficient way to do it. So far I understand that SQL server is a lot more powerfull than access which is what I've been using until now. Is SQL better only in instances where you have a lot of users browsing at the same time or does it perform the same as access when there are only 1 or 2 users?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top