操作系统和/或 IIS 缓存

发布于 2024-10-04 05:16:08 字数 358 浏览 4 评论 0原文

有没有一种方法可以强制在操作系统级别和/或 Web 服务器级别 (IIS) 缓存文件

我面临的问题是有许多静态文件(例如 xslt )需要一次又一次加载 - 并且我想将所有这些文件加载​​到内存中,这样就不会在硬盘 I/O 上浪费时间。

(1) 我想在操作系统级别缓存它,以便在我的操作系统上运行并尝试读取文件的每个程序都必须从内存中读取它。我不希望改变程序源代码——它必须透明地发生。例如,read("c:\abc.txt") 不得导致磁盘 I/O,它必须从内存中读取。

(2)在IIS中实现类似的事情。我读过一些关于数据库查询输出缓存的内容 - 但如何为文件实现它?

欢迎所有建议!

谢谢

Is there a way where I can force caching files at an OS level and/or Web Server level (IIS)

The problem I am facing is that there a many static files ( xslt's for example ) that need to be loaded again and again - and I want to load all these files to memory so that no time wasted on hard disk I/O.

(1) I want to cache it at the OS level so that every program that runs on my OS and which tries to read a file must read it from memory. I want no changing in program source code - it must happen transparently. For example, read("c:\abc.txt") must not cause a disk I/O, it must read it from the memory.

(2) Achieving similar thing in IIS. I've read few things about output caching for database queries - but how to achieve it for files?

All suggestions are welcome!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

装纯掩盖桑 2024-10-11 05:16:08

您应该研究SO 本身使用的一些技巧。一是他们将所有静态内容移至另一个域以提高效率。

Apache 默认设置的问题(至少)是 Web 服务器会将所有请求传递到应用程序服务器,以查看内容是否是动态的。对于您知道的静态内容来说,这是一种巨大的浪费。

最好在没有应用服务器的情况下为静态内容设置一个单独的域。这样,静态请求就不会不必要地发送到另一层,并且 Web 服务器可以运行得更快。

即使在每次都没有调用另一层的设置中,也有其他原因需要单独的域,正如您从该链接中看到的那样(特别是删除 cookie,这既减少了流量,又提高了 Internet 缓存数据的机会)。

You should look into some tricks used by SO itself. One was that they moved all their static content off to another domain for efficiency.

The problem with default set ups for Apache (at a minimum) is that the web server will pass all requests through to an app server to see if the content is meant to be dynamic. That's a huge waste for content that you know to be static.

Far better to set up a separate domain for static content without an app server. That way, the static requests are not sent unnecessarily to another layer and the web server can run much faster.

Even in a setup where there's not another layer invoked every time, there are other reasons for a separate domain, as you'll see from that link (specifically removing cookies which both reduces traffic and improves the chances of the Internet caching your data).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文