Adv. sessions & recordsets

Results 1 to 2 of 2

Thread: Adv. sessions & recordsets

  1. #1
    Join Date
    Dec 1969

    Default Adv. sessions & recordsets

    Ok, firstly this isn&#039;t a lame question. Read it first. :)<BR><BR>I&#039;ve created a DLL which interacts with Index Server / Site Server to allow a user to search a site. It&#039;s a little more complex than that, but that&#039;s a good enough generalisation.<BR><BR>However, I&#039;m at the stage where I want to optimise it. I&#039;ve got it working how I want, but there is one bit in particular which I want to work the fastest.<BR><BR>The pseudo-code used to work like so:<BR>1) Receive recordset from site server.<BR>2) Iterate through it and count records and mark unwanted links.<BR>3) Iterate through recordset avoiding unwanted links to create table.<BR><BR>Ok, ok, ok. No flames. It was awful from a speed point of view, but it worked. Showed management what it was meant to do at least.<BR><BR>I&#039;ve adapted the code now to do this:<BR>1) Receive recordset from Site/Index Server.<BR>2) Convert to array using GetRows.<BR>3) Destroy objects ASAP.<BR>4) Iterate through array and push correct links to a new array.<BR>5) Destroy initial array.<BR>6) Copy the array into a session variable.<BR>7) Iterate through the new array to create the table.<BR><BR>This seems a lot faster, especially when I made a small adaptation. Now the code only hits Site/Index Server when a new search is created. When it&#039;s not a new search (refreshes page, turns to another page), it uses the array already held in the session variable.<BR><BR>Pros:<BR>1) Incredible speed increase (only one hit to recordset rather than probably 100+)<BR>2) Means many of these sites can be held on one computer as the load on Site/Index Server is significantly reduced.<BR>Cons:<BR>1) Largish session variable, especially if the users search returns many hits.<BR><BR>The question (finally), is which would be better - to save the results in a large session array (multidimensional), or to hit the database multiple times? If I hit the database multiple times then I obviously have to parse the links again to find out if they are wanted again.<BR><BR>Any suggestions?<BR><BR>Craig.

  2. #2
    Join Date
    Dec 1969

    Default RE: Adv. sessions & recordsets

    You&#039;ve got a very expensive process to build the results - the database hit on it&#039;s own might be OK, but if you&#039;ve got to do all this other stuff then it could get pretty slow - so caching the search results in session scope is a probably good idea, and arrays are the fastest way to do it.<BR><BR>But since you&#039;ve got both versions, why not do some benchmarking? That&#039;s the only way to know for sure how the system will respond under load. Try looking at the Web Application Stress Tool from Microsoft - it should be just the ticket.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts