Massive speed difference between identical asp pages

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MikeT

    Massive speed difference between identical asp pages

    I have a page that produces little thumbnails of the 3D models it
    finds in a specified directory (and iterates down through any sub
    directories).

    It basically scans each directory for 3D Studio Max files using the
    filesystemobjec t and writes an activeX component called iDrop for each
    file so it can be displayed on the page (and drag-dropped straight
    into Max). If it happens to find a similarly named XML file in the
    directory, it loads that and transforms the content with a pre-loaded
    XSL stylesheet to provide a summary of the model's size/face
    count/etc. This is just for context though, just in case it is
    relevant.

    In response to complaints that it was running really slowly (from 6 to
    13 seconds to scan a directory with 3 models in it), I made a copy of
    the page to add debug timers to, so I could see where it was taking
    all the time.

    This copy completes in between 0.3 and 0.6 seconds for the same
    directory.

    The code is identical. I can cut and paste the code from the slow file
    to the fast one (or vice versa) and it makes no difference to the
    execution speed of either file. They both execute using the IUSR_foo
    account on the webserver. They are both in the same directory. The
    directory they are reading from has read permission for "Everyone".

    What gives? How is this possible? What is IIS doing differently for
    the two pages? Surely IIS should recompile a page if its modified date
    changes, so how can it compile two different execution schemes for the
    same code?

    The fix for me is to use the new page and not the old one, but I
    really want to know what is going on here.

    Server is IIS5.0 on Windows 2000 Server
  • Patrice

    #2
    Re: Massive speed difference between identical asp pages

    Have you found where exactly the time difference is ?

    For now it looks like to me that you see fast running server side code under
    all circumstances. If yes , the delay experienced by users is IMO the time
    taken to download all the 3D models so that they can be viewed by the
    (multiple) ActiveX control(s) hosted in your HTML page...

    If yes, you could try to donwload only those models the user actually wants
    to use...

    Patrice

    --

    "MikeT" <news@chthonic. f9.co.uk> a écrit dans le message de
    news:af4a582c.0 411170444.4a976 aa0@posting.goo gle.com...[color=blue]
    > I have a page that produces little thumbnails of the 3D models it
    > finds in a specified directory (and iterates down through any sub
    > directories).
    >
    > It basically scans each directory for 3D Studio Max files using the
    > filesystemobjec t and writes an activeX component called iDrop for each
    > file so it can be displayed on the page (and drag-dropped straight
    > into Max). If it happens to find a similarly named XML file in the
    > directory, it loads that and transforms the content with a pre-loaded
    > XSL stylesheet to provide a summary of the model's size/face
    > count/etc. This is just for context though, just in case it is
    > relevant.
    >
    > In response to complaints that it was running really slowly (from 6 to
    > 13 seconds to scan a directory with 3 models in it), I made a copy of
    > the page to add debug timers to, so I could see where it was taking
    > all the time.
    >
    > This copy completes in between 0.3 and 0.6 seconds for the same
    > directory.
    >
    > The code is identical. I can cut and paste the code from the slow file
    > to the fast one (or vice versa) and it makes no difference to the
    > execution speed of either file. They both execute using the IUSR_foo
    > account on the webserver. They are both in the same directory. The
    > directory they are reading from has read permission for "Everyone".
    >
    > What gives? How is this possible? What is IIS doing differently for
    > the two pages? Surely IIS should recompile a page if its modified date
    > changes, so how can it compile two different execution schemes for the
    > same code?
    >
    > The fix for me is to use the new page and not the old one, but I
    > really want to know what is going on here.
    >
    > Server is IIS5.0 on Windows 2000 Server[/color]


    Comment

    • Mark Schupp

      #3
      Re: Massive speed difference between identical asp pages

      Rename the "slow" file, then make a copy of the "fast" file with the "slow"
      file name. Is it still slow?

      Are you calling both files exactly the same way (by a link, form post, etc)?
      If you are calling by a link or form post swap the links and see if the
      performance problem follows the link.

      --
      --Mark Schupp
      Head of Development
      Integrity eLearning


      "MikeT" <news@chthonic. f9.co.uk> wrote in message
      news:af4a582c.0 411170444.4a976 aa0@posting.goo gle.com...[color=blue]
      >I have a page that produces little thumbnails of the 3D models it
      > finds in a specified directory (and iterates down through any sub
      > directories).
      >
      > It basically scans each directory for 3D Studio Max files using the
      > filesystemobjec t and writes an activeX component called iDrop for each
      > file so it can be displayed on the page (and drag-dropped straight
      > into Max). If it happens to find a similarly named XML file in the
      > directory, it loads that and transforms the content with a pre-loaded
      > XSL stylesheet to provide a summary of the model's size/face
      > count/etc. This is just for context though, just in case it is
      > relevant.
      >
      > In response to complaints that it was running really slowly (from 6 to
      > 13 seconds to scan a directory with 3 models in it), I made a copy of
      > the page to add debug timers to, so I could see where it was taking
      > all the time.
      >
      > This copy completes in between 0.3 and 0.6 seconds for the same
      > directory.
      >
      > The code is identical. I can cut and paste the code from the slow file
      > to the fast one (or vice versa) and it makes no difference to the
      > execution speed of either file. They both execute using the IUSR_foo
      > account on the webserver. They are both in the same directory. The
      > directory they are reading from has read permission for "Everyone".
      >
      > What gives? How is this possible? What is IIS doing differently for
      > the two pages? Surely IIS should recompile a page if its modified date
      > changes, so how can it compile two different execution schemes for the
      > same code?
      >
      > The fix for me is to use the new page and not the old one, but I
      > really want to know what is going on here.
      >
      > Server is IIS5.0 on Windows 2000 Server[/color]


      Comment

      • MikeT

        #4
        Re: Massive speed difference between identical asp pages

        "Mark Schupp" <notvalid@email .net> wrote in message news:<umA81AMzE HA.2752@TK2MSFT NGP11.phx.gbl>. ..[color=blue]
        >
        > "MikeT" <news@chthonic. f9.co.uk> wrote in message
        > news:af4a582c.0 411170444.4a976 aa0@posting.goo gle.com...[color=green]
        > >I have a page that produces little thumbnails of the 3D models it
        > > finds in a specified directory (and iterates down through any sub
        > > directories).
        > >
        > > It basically scans each directory for 3D Studio Max files using the
        > > filesystemobjec t and writes an activeX component called iDrop for each
        > > file so it can be displayed on the page (and drag-dropped straight
        > > into Max). If it happens to find a similarly named XML file in the
        > > directory, it loads that and transforms the content with a pre-loaded
        > > XSL stylesheet to provide a summary of the model's size/face
        > > count/etc. This is just for context though, just in case it is
        > > relevant.
        > >[/color]
        >
        > Rename the "slow" file, then make a copy of the "fast" file with the "slow"
        > file name. Is it still slow?
        >[/color]
        The file with the "slow" name becomes slow. The one that was slow
        becomes fast :) This kinda proves that it's something IIS is doing
        when executing the code. The same thing happens with a second page in
        the same directory that is used as a detailed view for a particular
        model. Again, making a new file with a new name speeds up the code,
        but the slowdown is associated with the filename and not the code
        itself.
        [color=blue]
        > Are you calling both files exactly the same way (by a link, form post, etc)?
        > If you are calling by a link or form post swap the links and see if the
        > performance problem follows the link.
        >[/color]

        I'm typing in a direct URL to the page with the same parameter (a
        directory
        path to scan) for each.

        Patrice wrote:
        [color=blue]
        > Have you found where exactly the time difference is ?
        >[/color]

        Inserting more timing checks makes it clear that one page is taking
        around 2 seconds to run through the files in a directory, the other
        <0.2 seconds. Specifically, it's taking a long time to get a file's
        name. The code makes repeated use of objFile.Name. Caching this name
        in a string (which I should have been doing anyway, doh) speeds up
        BOTH pages immensely, but the slow down factor for the files is still
        around 16 to 1. So it's the FileSystemObjec t that's got the problem.
        Why would getting a file name be so slow?
        [color=blue]
        >
        >
        > For now it looks like to me that you see fast running server side code
        > under all circumstances.
        >[/color]
        Nope - the timings are being done on the server side, the activeX
        loads
        the models clientside, so won't slow down the execution of the ASP.
        [color=blue]
        > If yes, you could try to donwload only those models the user actually
        > wants to use...[/color]

        Point taken, but this is a model library browser - they don't know
        what
        model they are looking for, they are browsing, say, 100 office chairs
        looking
        for the right one for the scheme they are modelling.


        Hmm. It looks like IIS has cached something to do with the page's
        name that
        isn't getting reset when the page is edited. I'll try restarting the
        IIS server, but if that fails I'm assuming the IIS metabase has got
        corrupted for the files that were in that directory, but it's beyond
        me what it might have cached that affects behaviour in this way.


        Here's the code for the loop that is being so slow:
        (splittime is my debug code that logs the elapsed time in milliseconds
        for each call, and writeGalleryMod el just outputs the HTML based on
        the available files, fso is a global fileSystemObjec t)

        sub listmodelsunder (libraryroot, librarywebroot, subpath, preview)

        dim thisFolder, subFolder, file
        dim bestproxyfile
        dim proxyfile
        dim xmlfile
        dim maxfile
        dim vrmlfile

        dim filename

        set thisfolder = fso.GetFolder(l ibraryroot & subpath)
        proxyfile = ""
        xmlfile = ""
        maxfile = ""
        vrmlfile = ""

        splittime(libra ryroot & subpath)
        for each file in thisFolder.File s

        filename = file.Name 'THIS IS THE CALL THAT TAKES 16 TIMES LONGER
        ON ONE PAGE
        splittime(filen ame & " start")
        select case fileextension(f ilename)
        case "jpg"
        if proxyfile = "" then proxyfile = filename

        if instr(1,filenam e,"best",1) > 0 then bestproxyfile =filename
        if instr(1,filenam e,preview,1) > 0 then proxyfile = filename

        case "max"
        if maxfile = "" then
        maxfile = filename
        else
        if filename = thisFolder.Name & ".max" then
        maxfile = filename
        end if
        end if

        case "xml"
        if instr(1,filenam e,"fileproperti es",1) > 0 then xmlfile =
        filename

        case "wrl"
        if vrmlfile = "" and preview = "3d" then vrmlfile = filename

        end select

        splittime(filen ame & " end")
        next
        splittime("scan complete")
        if proxyfile = "" or preview = "3d" then proxyfile = bestproxyfile

        if maxfile<>"" then 'this directory is a model, list it
        writeGalleryMod el library & subpath, librarywebroot & subpath,
        proxyfile, maxfile, xmlfile, vrmlfile
        modelcount = modelcount + 1
        else
        for each subFolder in thisFolder.subF olders
        listmodelsunder libraryroot, librarywebroot, subpath & "/" &
        subFolder.Name, preview
        next
        end if

        set thisfolder = nothing
        end sub

        Comment

        • Aaron [SQL Server MVP]

          #5
          Re: Massive speed difference between identical asp pages

          > the two pages? Surely IIS should recompile a page if its modified date[color=blue]
          > changes,[/color]

          Should != does. Did you restart IIS?


          Comment

          • MikeT

            #6
            Re: Massive speed difference between identical asp pages

            On Thu, 18 Nov 2004 09:42:49 -0500, "Aaron [SQL Server MVP]"
            <ten.xoc@dnartr eb.noraa> wrote:
            [color=blue][color=green]
            >> the two pages? Surely IIS should recompile a page if its modified date
            >> changes,[/color]
            >
            >Should != does. Did you restart IIS?
            >[/color]

            I tried this at lunchtime - no difference to the pages at all:
            anything using the original name is slow when using the
            filesystemobjec t, the same code under a new name runs at normal
            speed. This is getting silly.

            Mike

            Comment

            • Aaron [SQL Server MVP]

              #7
              Re: Massive speed difference between identical asp pages

              See the last section of http://www.aspfaq.com/2022 ... you may be able to
              resolve this by dropping the application and re-creating it.

              --
              Please contact this domain's administrator as their DNS Made Easy services have expired.

              (Reverse address to reply.)




              "MikeT" <news@chthonic. f9.co.uk> wrote in message
              news:0ahpp0lr6d 46a0it16on2qul5 b4kvo329e@4ax.c om...[color=blue]
              > On Thu, 18 Nov 2004 09:42:49 -0500, "Aaron [SQL Server MVP]"
              > <ten.xoc@dnartr eb.noraa> wrote:
              >[color=green][color=darkred]
              > >> the two pages? Surely IIS should recompile a page if its modified date
              > >> changes,[/color]
              > >
              > >Should != does. Did you restart IIS?
              > >[/color]
              >
              > I tried this at lunchtime - no difference to the pages at all:
              > anything using the original name is slow when using the
              > filesystemobjec t, the same code under a new name runs at normal
              > speed. This is getting silly.
              >
              > Mike[/color]


              Comment

              • Bob Barrows [MVP]

                #8
                Re: Massive speed difference between identical asp pages

                MikeT wrote:[color=blue]
                > On Thu, 18 Nov 2004 09:42:49 -0500, "Aaron [SQL Server MVP]"
                > <ten.xoc@dnartr eb.noraa> wrote:
                >[color=green][color=darkred]
                >>> the two pages? Surely IIS should recompile a page if its modified
                >>> date changes,[/color]
                >>
                >> Should != does. Did you restart IIS?
                >>[/color]
                >
                > I tried this at lunchtime - no difference to the pages at all:
                > anything using the original name is slow when using the
                > filesystemobjec t, the same code under a new name runs at normal
                > speed. This is getting silly.
                >
                > Mike[/color]
                What are the filenames? (grasping at straws)
                --
                Microsoft MVP -- ASP/ASP.NET
                Please reply to the newsgroup. The email account listed in my From
                header is my spam trap, so I don't check it very often. You will get a
                quicker response by posting to the newsgroup.


                Comment

                • MikeT

                  #9
                  Re: Massive speed difference between identical asp pages

                  On Thu, 18 Nov 2004 11:19:25 -0500, "Bob Barrows [MVP]"
                  <reb01501@NOyah oo.SPAMcom> wrote:
                  [color=blue]
                  >MikeT wrote:[color=green]
                  >> On Thu, 18 Nov 2004 09:42:49 -0500, "Aaron [SQL Server MVP]"
                  >> <ten.xoc@dnartr eb.noraa> wrote:
                  >>[color=darkred]
                  >>>> the two pages? Surely IIS should recompile a page if its modified
                  >>>> date changes,
                  >>>
                  >>> Should != does. Did you restart IIS?
                  >>>[/color]
                  >>
                  >> I tried this at lunchtime - no difference to the pages at all:
                  >> anything using the original name is slow when using the
                  >> filesystemobjec t, the same code under a new name runs at normal
                  >> speed. This is getting silly.
                  >>
                  >> Mike[/color]
                  >What are the filenames? (grasping at straws)[/color]

                  The slow ones are called gallery.asp and model.asp - both sub frames
                  of a simple two frame default.asp.

                  I copied the files and named them gallery2.asp and model2.asp and then
                  linked those names instead in the default.asp page to end up with a
                  normal running app.

                  So - I've 'fixed' the problem but still no closer to tracking this
                  down. Off to try Aaron's suggestion from the FAQ.

                  Mike

                  Comment

                  • Mark Schupp

                    #10
                    Re: Massive speed difference between identical asp pages

                    See Aaron's response. If that doesn't help:

                    Is the slow page slow when called a second time with the same parameters?
                    Does it make a difference which page is called first?

                    restart web-server (re-boot if possible)
                    1. call slow page
                    2. call fast page
                    restart web-server again
                    3. call fast page
                    4. call slow page

                    --
                    Mark Schupp
                    Head of Development
                    Integrity eLearning



                    "MikeT" <news@chthonic. f9.co.uk> wrote in message
                    news:0ahpp0lr6d 46a0it16on2qul5 b4kvo329e@4ax.c om...[color=blue]
                    > On Thu, 18 Nov 2004 09:42:49 -0500, "Aaron [SQL Server MVP]"
                    > <ten.xoc@dnartr eb.noraa> wrote:
                    >[color=green][color=darkred]
                    > >> the two pages? Surely IIS should recompile a page if its modified date
                    > >> changes,[/color]
                    > >
                    > >Should != does. Did you restart IIS?
                    > >[/color]
                    >
                    > I tried this at lunchtime - no difference to the pages at all:
                    > anything using the original name is slow when using the
                    > filesystemobjec t, the same code under a new name runs at normal
                    > speed. This is getting silly.
                    >
                    > Mike[/color]


                    Comment

                    • MikeT

                      #11
                      Re: Massive speed difference between identical asp pages

                      On Thu, 18 Nov 2004 08:42:29 -0800, "Mark Schupp" <nospan@nospam. com>
                      wrote:
                      [color=blue]
                      >See Aaron's response. If that doesn't help:
                      >
                      >Is the slow page slow when called a second time with the same parameters?
                      >Does it make a difference which page is called first?
                      >
                      >restart web-server (re-boot if possible)
                      >1. call slow page
                      >2. call fast page
                      >restart web-server again
                      >3. call fast page
                      >4. call slow page[/color]

                      OK Tried Aaron's idea, no joy.

                      But whilst I was logged into the webserver I checked the page
                      permissions again - the "slow" page was using a domain IUSR account we
                      set up ages ago when the libraries were on a different server to the
                      current one. The "fast" page was using the default local IUSR account.
                      The library itself couldn't care less as it has Everyone: read
                      permissions.

                      So - the speed difference is caused by the different authentication
                      methods. Each and every reference to oFile.Name was costing me lots of
                      time when using a domain account. Ouch. Teach me to use such similar
                      account names.

                      Thanks for all the help folks. There's nobody here to talk these sort
                      of problems through with, and sometimes that's the only way to solve
                      them.

                      Mike

                      Comment

                      • Mark Schupp

                        #12
                        Re: Massive speed difference between identical asp pages

                        Aaron,

                        this sounds like a keeper. you do have a category on aspfaq for "weird and
                        mystifying" stuff don't you?

                        --
                        Mark Schupp
                        Head of Development
                        Integrity eLearning



                        "MikeT" <news@chthonic. f9.co.uk> wrote in message
                        news:arkpp0t8mp e5tjec3s104m9k9 802o4s9ep@4ax.c om...[color=blue]
                        > On Thu, 18 Nov 2004 08:42:29 -0800, "Mark Schupp" <nospan@nospam. com>
                        > wrote:
                        >[color=green]
                        > >See Aaron's response. If that doesn't help:
                        > >
                        > >Is the slow page slow when called a second time with the same parameters?
                        > >Does it make a difference which page is called first?
                        > >
                        > >restart web-server (re-boot if possible)
                        > >1. call slow page
                        > >2. call fast page
                        > >restart web-server again
                        > >3. call fast page
                        > >4. call slow page[/color]
                        >
                        > OK Tried Aaron's idea, no joy.
                        >
                        > But whilst I was logged into the webserver I checked the page
                        > permissions again - the "slow" page was using a domain IUSR account we
                        > set up ages ago when the libraries were on a different server to the
                        > current one. The "fast" page was using the default local IUSR account.
                        > The library itself couldn't care less as it has Everyone: read
                        > permissions.
                        >
                        > So - the speed difference is caused by the different authentication
                        > methods. Each and every reference to oFile.Name was costing me lots of
                        > time when using a domain account. Ouch. Teach me to use such similar
                        > account names.
                        >
                        > Thanks for all the help folks. There's nobody here to talk these sort
                        > of problems through with, and sometimes that's the only way to solve
                        > them.
                        >
                        > Mike[/color]


                        Comment

                        • MikeT

                          #13
                          Re: Massive speed difference between identical asp pages

                          On Thu, 18 Nov 2004 09:15:54 -0800, "Mark Schupp" <nospan@nospam. com>
                          wrote:
                          [color=blue]
                          >Aaron,
                          >
                          >this sounds like a keeper. you do have a category on aspfaq for "weird and
                          >mystifying" stuff don't you?[/color]

                          When I have more time tomorrow, I'll see if I can narrow down the
                          behaviour to see exactly what the difference is, but the two major
                          gotchas are:

                          1) if you set things like the anonymous account used for
                          authentication on a page and then delete that page, a new page with
                          the name will inherit the old settings.

                          2) the filesystemobjec t appears to authenticate with every access to
                          an object. Well, at least, that is the only explanation I can find for
                          the behaviour I'm seeing. I'm going to be much more careful about
                          making lots of fso calls inside loops from now on - I've got a bunch
                          of other pages that I just thought were inherently slow that I'm going
                          to go back through now. The most useful page searches through around a
                          terabyte of Photoshop files so if I can speed that up, I'll be a very
                          happy man.

                          Mike

                          Comment

                          Working...