在高流量网络场场景网站中如何以及在何处存储用户上传的文件?

发布于 2024-08-24 18:06:28 字数 204 浏览 8 评论 0原文

我正在开发一个部署在网络农场上以服务高流量的网站。 我应该在哪里存储用户上传的文件?将上传的文件存储在同一网站的文件系统中并在所有网络服务器(网络场)中同步这些文件是否明智?或者我应该使用另一台服务器将所有上传的文件存储在该服务器中以将文件存储在中央位置? 如果单独的文件服务器是更好的选择,那么我如何有效地将文件从 Web 服务器传递到该文件服务器? 或者我应该将文件直接上传到该文件服务器?

i am working on a website which deploy on web farms to serve high traffic.
where should i store user uploaded files? is it wise to store uploaded files in the file system of the same website and synchronize these files in all web servers(web farm)? or should i use another server to store all uploaded files in this server to store files in a central location?
if separate file server will be a better choice, than how can i pass files from web server to that file server efficiently?
or should i upload files directly to that file server?

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

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

发布评论

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

评论(3

§普罗旺斯的薰衣草 2024-08-31 18:06:28

出于安全原因,您无论如何都希望从不同的子域提供文件。如果这些文件的流量允许的话,通过为这些文件专用一台服务器会更容易,但这也会造成您可能希望避免的单点故障和瓶颈。

您可以让所有 Web 服务器提供来自中央文件服务器或本地缓存副本的文件。这在很大程度上取决于文件是否发生变化。

For security reasons you want to serve the files from a different sub-domain anyways. This is easier by dedicating one server for these files, if the traffic for these files warrants it, but that also creates a single point of failure and bottleneck which you probably want to avoid.

You can have all web servers serve the files from a central file server or local cached copies. This depends a lot on if the files ever change.

日暮斜阳 2024-08-31 18:06:28

您是否考虑过使用 Amazon S3 来存储和提供用户上传的文件?

否则,数据中心的中央文件服务器是有意义的。您可以使用 NFS 或类似方式在每个 Web 服务器上本地安装存储。

无论您选择如何存储这些文件,您都应该始终从不同的域提供用户提供的文件,以避免跨域攻击。

Have you considered using Amazon S3 to store and serve user-uploaded files?

Otherwise, a central file server in your data center makes sense. You could mount the storage locally on each of your web servers using NFS or similar.

However you choose to store these files, you should always serve user-provided files from a different domain to avoid cross-domain exploits.

嗳卜坏 2024-08-31 18:06:28

您询问 Facebook 如何存储照片。您可能想阅读以下文章:

大海捞针:高效存储数十亿张照片

You asked about how Facebook stores photos. You might want to read the following article:

Needle in a haystack: efficient storage of billions of photos

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