相同的asp页面之间的巨大速度差异 [英] Massive speed difference between identical asp pages

查看:55
本文介绍了相同的asp页面之间的巨大速度差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面可以生成3D模型的小缩略图,它会在指定目录中找到
(并向下遍历任何子目录)。


它基本上使用

文件系统对象扫描每个目录中的3D Studio Max文件,并为每个

文件写一个名为iDrop的activeX组件,以便它可以显示在页面上(直接拖放

到Max)。如果碰巧在

目录中找到一个类似命名的XML文件,它会加载该文件并使用预先加载的
XSL样式表转换内容,以提供模特的大小/面孔

count / etc.这只是为了上下文,以防它是相关的




回应投诉它运行得非常慢(从6到
13秒扫描一个包含3个模型的目录),我在页面上复制了一个

来添加调试计时器,所以我可以看到它在哪里

所有时间。


对于相同的

目录,此副本在0.3到0.6秒之间完成。


代码完全相同。我可以将慢速文件

中的代码剪切并粘贴到快速文件中(反之亦然),这对任一文件的执行速度没有影响。他们都使用网络服务器上的IUSR_foo

帐户执行。它们都在同一目录中。他们正在阅读的

目录具有Everyone的读取权限。


给出了什么?这怎么可能?什么是对两个页面的

采取不同的做法?当IIS的修改日期

发生变化时,IIS应该重新编译一个页面,那么如何为

相同的代码编译两个不同的执行方案呢?


我的修复是使用新页面而不是旧页面,但是我确实想知道这里发生了什么。


服务器是Windows 2000 Server上的IIS5.0

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
filesystemobject 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

推荐答案

您是否找到了时间差的确切位置?


现在看起来我觉得在所有情况下你都会在

下看到快速运行的服务器端代码。如果是,用户经历的延迟是IMO下载所有3D模型所花费的时间,以便可以通过

(多个)ActiveX控件查看它们(s )在你的HTML页面中托管......


如果是的话,你可以尝试只下载用户实际想要的模型

来使用...


Patrice


-


" MikeT" <是ne ** @ chthonic.f9.co.uk> écritdansle message de

news:af ************************** @ posting.google.c om ...
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" <ne**@chthonic.f9.co.uk> a écrit dans le message de
news:af**************************@posting.google.c om...
我有一个页面可以生成在指定目录中找到的3D模型的小缩略图(并向下遍历任何子目录)。

它基本上使用
filesystemobject扫描每个目录中的3D Studio Max文件,并为每个
文件写一个名为iDrop的activeX组件,以便它可以显示在页面上(并直接拖放)进入Max)。如果碰巧在
目录中找到一个类似命名的XML文件,它会加载它并使用预先加载的XSL样式表转换内容,以提供模型的大小/面的摘要
计数/等。这只是为了上下文,以防它是相关的。

回应投诉它运行得非常慢(从6到
13秒扫描一个目录有3个模型),我制作了一个页面的副本来添加调试计时器,所以我可以一直看到它在哪里。

这个副本对于相同的
目录,在0.3到0.6秒之间完成。

代码完全相同。我可以将慢速文件中的代码剪切并粘贴到快速文件中(反之亦然),这对任一文件的执行速度没有影响。它们都使用Web服务器上的IUSR_foo
帐户执行。它们都在同一目录中。他们正在阅读的
目录具有Everyone的读取权限。

是什么给出的?这怎么可能?什么是IIS对这两个页面采取不同的做法?如果一个页面的修改日期改变了,那么IIS应该重新编译一个页面,那么如何为相同的代码编译两个不同的执行方案?

对我来说,修复是使用新页面,而不是旧页面,但我真的想知道这里发生了什么。

服务器是Windows 2000 Server上的IIS5.0
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
filesystemobject 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



重命名slow文件,然后制作快速的副本具有慢

文件名的文件。它仍然很慢吗?


您是否以完全相同的方式调用两个文件(通过链接,表格等)?

如果您打电话给链接或表单帖子交换链接,看看

性能问题是否跟在链接之后。


-

- Mark Schupp

开发负责人

诚信电子学习
www.ielearning.com


" MikeT" <是ne ** @ chthonic.f9.co.uk>在留言中写道

news:af ************************** @ posting.google.c om ...
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
www.ielearning.com

"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
我有一个页面可以生成在指定目录中找到的3D模型的小缩略图(并向下遍历任何子目录)。
filesystemobject扫描每个目录中的3D Studio Max文件,并为每个
文件写一个名为iDrop的activeX组件,以便它可以在页面上显示(并直接拖放
进入Max)。如果碰巧在
目录中找到一个类似命名的XML文件,它会加载它并使用预先加载的XSL样式表转换内容,以提供模型的大小/面的摘要
计数/等。这只是为了上下文,以防它是相关的。

回应投诉它运行得非常慢(从6到
13秒扫描一个目录有3个模型),我制作了一个页面的副本来添加调试计时器,所以我可以一直看到它在哪里。

这个副本对于相同的
目录,在0.3到0.6秒之间完成。

代码完全相同。我可以将慢速文件中的代码剪切并粘贴到快速文件中(反之亦然),这对任一文件的执行速度没有影响。它们都使用Web服务器上的IUSR_foo
帐户执行。它们都在同一目录中。他们正在阅读的
目录具有Everyone的读取权限。

是什么给出的?这怎么可能?什么是IIS对这两个页面采取不同的做法?如果一个页面的修改日期改变了,那么IIS应该重新编译一个页面,那么如何为相同的代码编译两个不同的执行方案?

对我来说,修复是使用新页面,而不是旧页面,但我真的想知道这里发生了什么。

服务器是Windows 2000 Server上的IIS5.0
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
filesystemobject 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



" Mark Schupp" <无****** @ email.net>在消息新闻中写道:< um ************** @ TK2MSFTNGP11.phx.gbl> ...
"Mark Schupp" <no******@email.net> wrote in message news:<um**************@TK2MSFTNGP11.phx.gbl>...

" MikeT" <是ne ** @ chthonic.f9.co.uk>在消息中写道
新闻:af ************************** @ posting.google.c om ...

"MikeT" <ne**@chthonic.f9.co.uk> wrote in message
news:af**************************@posting.google.c om...
我有一个页面可以生成在指定目录中找到的3D模型的缩略图(并在任何子目录中向下迭代)。

它基本上使用
filesystemobject扫描每个目录中的3D Studio Max文件,并为每个
文件写一个名为iDrop的activeX组件,以便它可以显示在页面上(并直接拖放到Max中) 。如果碰巧在
目录中找到一个类似命名的XML文件,它会加载它并使用预先加载的XSL样式表转换内容,以提供模型的大小/面的摘要
计数/等。这只是为了上下文,以防它是相关的。

重命名慢。文件,然后制作快速的副本具有慢
文件名的文件。它仍然很慢吗?
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
filesystemobject 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.

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



带有慢的文件名字变得缓慢。那个很慢的那个很快就会变得很快:)这有点证明了IIS在执行代码时正在做的事情是
。同样的事情发生在

中的第二个页面,该目录用作特定

模型的详细视图。再次,使用新名称创建一个新文件会加快代码,

但是减速与文件名相关联而不是代码

本身。

您是否以完全相同的方式调用这两个文件(通过链接,表单等)?
如果您通过链接或表单发帖调用交换链接并查看是否存在性能问题点击链接。


我正在输入具有相同参数的页面的直接URL(

目录
$ b $ (b)扫描路径)每个。


Patrice写道:

您是否找到了时间差的确切位置?


插入更多的时间检查表明,一个页面需要大约2秒才能通过目录中的文件运行
,另一个页面需要

< 0.2秒。具体来说,获取文件'

名称需要很长时间。该代码重复使用objFile.Name。缓存这个名字

在一个字符串中(我本来应该这样做,doh)加速

两页很大,但文件的减速因子仍然是

大约是16比1.所以FileSystemObject就是问题所在。

为什么文件名这么慢?


现在看起来我觉得你在任何情况下都能看到快速运行的服务器端代码

Nope - 正在服务器端完成时间, activeX

加载

模型客户端,所以不会减慢ASP的执行速度。

如果是,你可以试试只卸载用户实际想要使用的那些模型...


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.
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.

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

Patrice wrote:
Have you found where exactly the time difference is ?

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 FileSystemObject that''s got the problem.
Why would getting a file name be so slow?


For now it looks like to me that you see fast running server side code
under all circumstances.
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.
If yes, you could try to donwload only those models the user actually
wants to use...




点了,但这是一个模型库浏览器 - 他们不是知道

什么

模特他们正在寻找,他们正在浏览,比方说,100张办公椅

寻找

对于该计划的正确计划,他们是模型玲。

嗯。看起来IIS缓存了与页面'

名称有关的内容

在编辑页面时没有被重置。我会尝试重新启动

IIS服务器,但是如果失败了我假设IIS元数据库已经损坏了该目录中的文件,b $ b已损坏但它超出了我可能已缓存的内容,这会以这种方式影响行为。

这里的循环代码非常慢:

(splittime是我的调试代码,用于记录每个调用的经过时间(以毫秒为单位)

,而writeGalleryModel只输出基于

的HTML可用文件,fso是一个全局的fileSystemObject)


子listmodelsunder(libraryroot,librarywebroot,subpath,preview)


dim thisFolder,subFolder,file

dim bestproxyfile

dim proxyfile

dim xmlfile

dim maxfile

dim vrmlfile


dim文件名


设置thisfolder = fso.GetFolder(libraryroot& subpath)

proxyfile ="

xmlfile ="&q uot;

maxfile =""

vrmlfile =""


splittime(libraryroot&子路径)
这个文件中的每个文件都是
。文件


filename = file.Name''这是16次以上的调用

ON ON PAGE

splittime(文件名&开始)

选择案例fileextension(文件名)

case" jpg" ;

if proxyfile =""然后proxyfile = filename


if instr(1,filename," best",1)> 0然后bestproxyfile = filename

if instr(1,filename,preview,1)> 0然后proxyfile = filename


case" max"

if maxfile =""然后

maxfile = filename

else

if filename = thisFolder.Name& "&的.max QUOT;然后

maxfile = filename

结束如果

结束如果


case" xml"

if instr(1,filename," fileproperties",1)> 0然后xmlfile =

文件名


case" wrl"

if vrmlfile =""和preview =" 3d"然后vrmlfile =文件名


结束选择


splittime(文件名&"结束")

next

splittime(扫描完成)

if proxyfile =""或者预览=" 3d"然后proxyfile = bestproxyfile


if maxfile<>""然后''这个目录是一个模型,列出它

writeGalleryModel library& subpath,librarywebroot& subpath,

proxyfile,maxfile,xmlfile,vrmlfile

modelcount = modelcount + 1

else

for each subFolder in thisFolder.subFolders

listmodelsunder libraryroot,librarywebroot,subpath& " /" &

subFolder.Name,预览

next

结束如果


set thisfolder = nothing

end sub



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 writeGalleryModel just outputs the HTML based on
the available files, fso is a global fileSystemObject)

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(libraryroot & subpath)
proxyfile = ""
xmlfile = ""
maxfile = ""
vrmlfile = ""

splittime(libraryroot & subpath)
for each file in thisFolder.Files

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

if instr(1,filename,"best",1) > 0 then bestproxyfile =filename
if instr(1,filename,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,filename,"fileproperties",1) > 0 then xmlfile =
filename

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

end select

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

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

set thisfolder = nothing
end sub


这篇关于相同的asp页面之间的巨大速度差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆