Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 ADO Constants usage (please read)
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 5

GauravBhabu
Advanced Member

4288 Posts

Posted - 17 August 2002 :  21:25:42  Show Profile
quote:
Originally posted by ruirib
In fact I usually use client side cursors for paging, but I'm not sure what is best, speed wise: a client side forward only cursor, or a server side static cursor. Will have to test it later.



A client side forward only cursor will be processed as Client Side Static (or Keyset) Cursor.

You can determine how it was processed by writting
Response.write Recordset.CursorType

This will return a number value associated with the constant.

<Edit>Corrections

Edited by - GauravBhabu on 17 August 2002 21:29:24
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 August 2002 :  22:06:32  Show Profile
changed it back to adOpenStatic
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 August 2002 :  22:19:47  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by RichardKinser

changed it back to adOpenStatic


Yes, I've just confirmed that whenever you use paging it's better to use server side cursors and use adOpenStatic. I've made some tests both with Access and SQL Server and the difference not being significative, server side cursors are obviously faster.

So I'd stick to adOpenStatic whenever paging is needed.

(Still puzzled as to why Wrox's book uses client side cursors for this. What a stupid thing to suggest...without clarifying why they do it, and the trade-offs involved)

(edited for clarity of meaning)


Snitz 3.4 Readme | Like the support? Support Snitz too

Edited by - ruirib on 17 August 2002 23:41:03
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 August 2002 :  22:26:10  Show Profile
the files on this site have all been updated, so if there was going to be an error, we should see it.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 August 2002 :  22:39:58  Show Profile  Send ruirib a Yahoo! Message
The difference will not be that relevant, since the page generation time for topic.asp is very small but the code for the Jump To Last Topic could also be changed to reflect these changes, that is, comment or remove the line that makes the cursor a client one and open the recordset as adOpenStatic.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 August 2002 :  22:43:27  Show Profile
it's been changed.
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 17 August 2002 :  22:48:40  Show Profile
[quote]
The Significance of Cursor Location

Every cursor uses temporary resources to hold its data. These resources can be memory, a disk paging file, temporary disk files, or even temporary storage in the database. The cursor is called a client-side cursor when these resources are located on the client computer. The cursor is called a server-side cursor when these resources are located on the server.

Client-Side Cursors
In ADO, call for a client-side cursor by using the adUseClient CursorLocationEnum. With a non-keyset client-side cursor, the server sends the entire result set across the network to the client computer. The client computer provides and manages the temporary resources needed by the cursor and result set. The client-side application can browse through the entire result set to determine which rows it requires.

Static and keyset-driven client-side cursors may place a significant load on your workstation if they include too many rows. While all of the cursor libraries are capable of building cursors with thousands of rows, applications designed to fetch such large rowsets may perform poorly. There are exceptions, of course. For some applications, a large client-side cursor might be perfectly appropriate and performance might not be an issue.

One obvious benefit of the client-side cursor is quick response. After the result set has been downloaded to the client computer, browsing through the rows is very fast. Your application is generally more scalable with client-side cursors because the cursor's resource requirements are placed on each separate client and not on the server.


Server-Side Cursors
In ADO, call for a server-side cursor by using the adUseServer CursorLocationEnum. With a server-side cursor, the server manages the result set using resources provided by the server computer. The server-side cursor returns only the requested data over the network. This type of cursor can sometimes provide better performance than the client-side cursor, especially in situations where excessive network traffic is a problem.

However, it is important to point out that a server-side cursor is—at least temporarily—consuming precious server resources for every active client. You must plan accordingly to ensure that your server hardware is capable of managing all of the server-side cursors requested by active clients. Also, a server-side cursor can be slow because it provides only single row access—there is no batch cursor available.

Server-side cursors are useful when inserting, updating, or deleting records. With server-side cursors, you can have multiple active statements on the same connection.



CSS and HTML4.01 Compilant Snitz Forum . ForumSquare . Rakesh Jain

It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.

Prayer Of Forgiveness
"I forgive all living beings. May all living beings forgive me!
I cherish the friendliness towards all and harbour enmity towards none." -- Aavashyaka Sutra(Translated)
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 17 August 2002 :  22:54:23  Show Profile
It is better to use, in most situations, a Client-Side Static cursor if no additions/changes to the database are required.
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 August 2002 :  23:01:46  Show Profile
so for displaying topics/replies it would be best to use a Client Side adOpenStatic cursor ?
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 August 2002 :  23:10:00  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by GauravBhabu


Client-Side Cursors
In ADO, call for a client-side cursor by using the adUseClient CursorLocationEnum. With a non-keyset client-side cursor, the server sends the entire result set across the network to the client computer. The client computer provides and manages the temporary resources needed by the cursor and result set. The client-side application can browse through the entire result set to determine which rows it requires.



I don't know if they are referring to non-keyset cursors thinking about the future, because it seems now that there are only static client-side cursors. So, you'll get the entire recordset sent from the database to the Web Server.

quote:

One obvious benefit of the client-side cursor is quick response. After the result set has been downloaded to the client computer, browsing through the rows is very fast. Your application is generally more scalable with client-side cursors because the cursor's resource requirements are placed on each separate client and not on the server.


I suppose this depends on your page size, although I could not confirm this. The small tests I made (I used 15, 30 record and 100 records and paged through them), with a +-6000 record recordset, server-side cursors were always faster, both with Access and SQL Server. The difference to server side recordsets was more than a second (server side being faster), with Access and 100 page records.
Scalability? Well if you're using the same machine as Web server and database server I'd say scalability won't benefit from client side cursors as well. With different DB and Web servers maybe this improves, but then response time may be affected by network traffic, when using a client side cursor (as referred in the server side cursors text).


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 17 August 2002 :  23:11:03  Show Profile
Yes, That will be a better option.
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 17 August 2002 :  23:11:50  Show Profile  Visit Gremlin's Homepage
What are the bandwidth implications of that ? sending an entire recordset to the user could amount in some serious bandwidth increases for some forums couldnt it ?

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 August 2002 :  23:14:55  Show Profile  Send ruirib a Yahoo! Message
quote:
Originally posted by GauravBhabu

Yes, That will be a better option.


Well as my previous post showed, it won't be faster (at least for my computer). Also with a Web Server / database server in the same machine how will scalability be better? So, if you have slower page generation times and no gain from scalability, how can it be better?


Snitz 3.4 Readme | Like the support? Support Snitz too

Edited by - ruirib on 17 August 2002 23:17:42
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 17 August 2002 :  23:20:59  Show Profile
ok.. no client side cursors then.
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 17 August 2002 :  23:28:27  Show Profile  Send ruirib a Yahoo! Message
Richard, maybe Gaurav has some info that I don't have. As I wrote, I was using client-side cursors whenever paging was needed until this very topic made me want to test it.
I did test it with Access and SQL Server and found server side cursors faster, specially with Access. However it is possible that further testing is needed.

Will these results be reproduced with a server with higher load? Well I guess I'm gonna stress test my server a bit and verify what happens. Will post about it a bit later...


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07