压缩文件属性如何影响 Windows 中保存的文件的性能?

发布于 2024-08-05 17:31:04 字数 312 浏览 3 评论 0原文

问题:

如果我在 Windows 服务器上的目录上设置压缩属性,这对文件保存性能有何影响?

为什么我想知道:

我有一个服务器,多个批处理进程在其上保存巨大的文件,这些文件主要是 Txt 或 CSV 文件,我想压缩它们以节省磁盘空间。

如果它在写入文件时进行动态压缩,我将不得不在写入时查找 CPU 使用情况,这可能是一个问题。

如果它以未压缩的方式写入它们,然后后台线程对其进行压缩,那将是理想的 - 因为批处理进程在写入时不会减慢。

我的替代解决方案是不在目录上设置属性,而是让计划作业在这些文件上运行紧凑命令。

QUESTION:

If I set the compression attribute on a directory on a windows server, how does that effect file saving performance?

WHY I WANT TO KNOW:

I have a server that several batch processes save huge files on, and these are mostly Txt or CSV files that I'd like to compress to save disk space.

If it does compression on the fly as it writes the files, I would have to look for CPU usage when writing, and that may be an issue.

If it writes them uncompressed, and a background thread later compresses it, that would be ideal - as the batch processes would not be slowed down when they do their writes.

My alternative solution would be to not set the attribute on the directory, but have a scheduled job run the compact command on these files.

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

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

发布评论

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

评论(1

栩栩如生 2024-08-12 17:31:04

这与编程无关,但无论如何:

从磁盘读取和写入将需要一些额外的 CPU 处理,因为压缩是一项 CPU 密集型任务。

然而,读取和写入文件通常受 I/O 限制,而不是 CPU 限制。因此,您的计算机将花费更多时间等待数据写入/读取,而不是等待数据压缩/解压缩。

只要您的服务器不缺乏 CPU,您就不应该看到性能发生重大变化。

当然,在实施任何此类更改之前,请在模拟真实服务器条件的测试环境中进行一些测试。

编辑:

This isn't programming related, but here goes anyway:

Reading and writing from disk will require some extra CPU processing since compression is a CPU intensive task.

However, reading and writing files is typically I/O bound, not CPU bound. So your computer will spend more time waiting for the data to be written/read than it will waiting for data to be compressed/uncompressed.

So long your server isn't CPU starved, you shouldn't see a big change in performance.

Of course, before you implement any kind of changes like this, do some testing in a test environment that simulates your real server conditions.

Edit:

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