1

We have a project page which consists of users' files, multimedia stuff, etc and we want to allow the user to export all this out into a single zip file. We're using unix and mysql to store all of these currently and our primary goal is to minimize load/performance time from all the processing and compiling all the files into a zip file.

My idea was to cache the zip file into a temp dir and keep all the CRC checksum for each files in the zip into a separate text file. Each time the user tries to do an export I will first check through each file's CRC and compare it to the list before adding or removing files from the zip file.

But my other concern is also the space that the zip file will be occupying as we might have a lot of users.

IMHO, this is probably the dumbest way possible to do this, so can any of you guys please suggest a better way to deal with this problem?

thanks ~codeNoobian

4

3 回答 3

2

这意味着过早的优化,只需使用非常轻的压缩,也就是“最快”,如果它真的是一个问题,请担心速度。

于 2008-11-17T01:49:57.243 回答
0

如果带宽/下载速度不是问题,我建议您使用未压缩的 tar 文件。TAR 是一种非常简单的格式,因此当一些文件发生更改时,很容易编写代码来更新它的部分。此外,不压缩它会大大节省服务器 CPU 时间。

当然,不压缩会占用服务器上的大量存储空间。但是由于它是未压缩的,它可能完全不需要您保留文件的缓存副本,如果您可以足够快地构建它,您可以根据需要即时构建它。然后,您也不必担心存储 CRC 和更新 TAR。

于 2008-11-17T01:41:40.490 回答
0

普通的声音和图像文件一开始就被很好地压缩了,不是吗?可能值得查看您的有效负载,以了解您通过压缩购买了多少。

于 2008-11-17T02:08:08.987 回答