如何提高IIS / ASP.Net上的启动性能

时间:2022-06-01 14:02:10

I am using a particularly slow virtual web host (name withheld!) where disk performance can be very bad. Thus, the first hit to my ASP.Net web sites can take 1+ minutes to load. (After initial load, it's all in RAM and fine.)

我正在使用一个特别慢的虚拟Web主机(名称保留!),其中磁盘性能可能非常糟糕。因此,我的ASP.Net网站的第一次点击可能需要1分钟以上才能加载。 (初始加载后,它全部在RAM中并且很好。)

I am wondering if anyone knows a way to instruct IIS to pre-load the site? Is essence, emulate the first hit?

我想知道是否有人知道指示IIS预加载网站的方法?是本质,效仿第一击?

I have played with all the precompilation stuff, it helps, but it's not a substitute for the above.

我玩过所有预编译的东西,它有所帮助,但它不能代替上面的内容。

Thanks!

5 个解决方案

#1


3  

Does your application need to recycle? All of the recycle options are in the IIS configuration and can be adjusted to be appropriate for your application.

您的应用程序是否需要回收?所有回收选项都在IIS配置中,可以根据您的应用进行调整。

The ideal scenario would be to remove all of the application recycles so that the application always remains loaded. Recycling would then only occur if the web.config file was changed or a new version of the application was deployed.

理想的情况是删除所有应用程序回收,以便应用程序始终保持加载状态。只有在更改了web.config文件或部署了新版本的应用程序时,才会进行回收。

If daily recycling is required, as per the previous answer, a batch file could be used to recycle the application and it could also call iexplore.exe with the URL of the application to "pre-load" it.

如果需要每日回收,根据上一个答案,可以使用批处理文件来回收应用程序,也可以使用应用程序的URL调用iexplore.exe来“预加载”它。

#2


0  

why can't you have a batch file that has iis reset in it and have it schedule to execute every day at a certain time (when you have no users on your system)?

为什么你不能拥有一个iis重置的批处理文件,并让它安排在某个时间每天执行(当你的系统上没有用户时)?

#3


0  

If your provider can have a way for you to hook into when they are restarting the web server, you can have a batch file / script file hitting your website after the the web server restart. You'll only need to hit unique ASP.NET assembly files to get that particular assembly into memory. So if you have 1 assembly containing 10 pages, just hit one of the pages. It should be enough. If you have more than 1 assembly, hit 1 page in each assembly to load those assemblies into memory.

如果您的提供商可以在重新启动Web服务器时找到方法,则可以在Web服务器重新启动后让批处理文件/脚本文件访问您的网站。您只需要访问唯一的ASP.NET程序集文件即可将该特定程序集放入内存中。因此,如果您有一个包含10个页面的程序集,只需点击其中一个页面即可。这应该够了。如果您有多个程序集,请在每个程序集中单击1页以将这些程序集加载到内存中。

If you can't have it at your provider, then you have to think of a smarter way to do this on your own (i.e. learn when the provider is resetting the web server and schedule task in your machine to hit those pages yourself).

如果你不能在你的提供商处拥有它,那么你必须考虑一种更聪明的方法来自己完成这项工作(即了解提供商何时重置网络服务器并在你的机器中安排任务以自己点击这些页面)。

#4


0  

How much of the site do you want to have pre-loaded? How many pages?

您希望预先加载多少网站?多少页?

You can pre-compile the site, to remove the "compilation" part of the issue, but if the site is large enough, it may not make sense to "pre-load" the site. This would be especially true if the site runs on multiple hosts.

您可以预编译该站点,以删除该问题的“编译”部分,但如果该站点足够大,则“预加载”该站点可能没有意义。如果站点在多个主机上运行,​​则尤其如此。

#5


0  

The first time you request a page from a compiled ASP.NET application after its assemblies have been modified, it takes a lot longer to process than a normal page request.

在修改程序集后,第一次从已编译的ASP.NET应用程序请求页面时,处理时间比正常页面请求要长很多。

A simple solution to your problem is therefore to request a page from your application immediately after any modifications. That way you are the first to request a page, and you incur the long wait rather than your users.

因此,对您的问题的简单解决方案是在任何修改后立即从您的应用程序请求页面。这样你就是第一个请求页面的人,而你需要等待而不是用户。

#1


3  

Does your application need to recycle? All of the recycle options are in the IIS configuration and can be adjusted to be appropriate for your application.

您的应用程序是否需要回收?所有回收选项都在IIS配置中,可以根据您的应用进行调整。

The ideal scenario would be to remove all of the application recycles so that the application always remains loaded. Recycling would then only occur if the web.config file was changed or a new version of the application was deployed.

理想的情况是删除所有应用程序回收,以便应用程序始终保持加载状态。只有在更改了web.config文件或部署了新版本的应用程序时,才会进行回收。

If daily recycling is required, as per the previous answer, a batch file could be used to recycle the application and it could also call iexplore.exe with the URL of the application to "pre-load" it.

如果需要每日回收,根据上一个答案,可以使用批处理文件来回收应用程序,也可以使用应用程序的URL调用iexplore.exe来“预加载”它。

#2


0  

why can't you have a batch file that has iis reset in it and have it schedule to execute every day at a certain time (when you have no users on your system)?

为什么你不能拥有一个iis重置的批处理文件,并让它安排在某个时间每天执行(当你的系统上没有用户时)?

#3


0  

If your provider can have a way for you to hook into when they are restarting the web server, you can have a batch file / script file hitting your website after the the web server restart. You'll only need to hit unique ASP.NET assembly files to get that particular assembly into memory. So if you have 1 assembly containing 10 pages, just hit one of the pages. It should be enough. If you have more than 1 assembly, hit 1 page in each assembly to load those assemblies into memory.

如果您的提供商可以在重新启动Web服务器时找到方法,则可以在Web服务器重新启动后让批处理文件/脚本文件访问您的网站。您只需要访问唯一的ASP.NET程序集文件即可将该特定程序集放入内存中。因此,如果您有一个包含10个页面的程序集,只需点击其中一个页面即可。这应该够了。如果您有多个程序集,请在每个程序集中单击1页以将这些程序集加载到内存中。

If you can't have it at your provider, then you have to think of a smarter way to do this on your own (i.e. learn when the provider is resetting the web server and schedule task in your machine to hit those pages yourself).

如果你不能在你的提供商处拥有它,那么你必须考虑一种更聪明的方法来自己完成这项工作(即了解提供商何时重置网络服务器并在你的机器中安排任务以自己点击这些页面)。

#4


0  

How much of the site do you want to have pre-loaded? How many pages?

您希望预先加载多少网站?多少页?

You can pre-compile the site, to remove the "compilation" part of the issue, but if the site is large enough, it may not make sense to "pre-load" the site. This would be especially true if the site runs on multiple hosts.

您可以预编译该站点,以删除该问题的“编译”部分,但如果该站点足够大,则“预加载”该站点可能没有意义。如果站点在多个主机上运行,​​则尤其如此。

#5


0  

The first time you request a page from a compiled ASP.NET application after its assemblies have been modified, it takes a lot longer to process than a normal page request.

在修改程序集后,第一次从已编译的ASP.NET应用程序请求页面时,处理时间比正常页面请求要长很多。

A simple solution to your problem is therefore to request a page from your application immediately after any modifications. That way you are the first to request a page, and you incur the long wait rather than your users.

因此,对您的问题的简单解决方案是在任何修改后立即从您的应用程序请求页面。这样你就是第一个请求页面的人,而你需要等待而不是用户。