简体   繁体   English

存储静态内容时,应用程序大小是否重要?

[英]Does application size matters when storing static content?

I'm planning to store HTMLs,PDFs and image files in my node application in the public folder instead of some s3 bucket b/ci want to have the cleaner urls from my domain instead of s3 url. 我打算将HTML,PDF和图像文件存储在公共文件夹中的节点应用程序中,而不是将某些s3存储桶b / ci存储在我的域中,而不是s3 url中。 over time my application grows to contain more than 50k HTMLs, PDFs and images. 随着时间的流逝,我的应用程序越来越多,包含了超过5万个HTML,PDF和图像。

  • Does this slows down the application in the future since the application footprint will be huge or will it still work fine? 由于应用程序占用空间巨大或仍然可以正常使用,这会在将来减慢应用程序的速度吗?

  • What are the potential downsides of storing huge amount of static content within the app? 在应用程序内存储大量静态内容的潜在弊端是什么?

The size of the application has a small impact on its performance. 应用程序的大小对其性能有很小的影响。 There are many other factors that have a larger impact. 还有许多其他影响更大的因素。

One downside of storing static content within the app is that it isn't distributed and doesn't scale well. 在应用程序内存储静态内容的一个缺点是,静态内容无法分发且无法很好地扩展。

Does this slows down the application in the future since the application footprint will be huge or will it still work fine? 由于应用程序占用空间巨大或仍然可以正常使用,这会在将来减慢应用程序的速度吗?

It does not matter if you have 100Kb or 100Gb stored locally. 本地存储100Kb或100Gb都没有关系。 The amount of data stored on the local hard drive has nothing to do with your application's performance. 存储在本地硬盘驱动器上的数据量与应用程序的性能无关。

If you put a zillion files all in one directory, that could slightly impact the OS performance of file operations in that directory, but if you spread your files out with no more than a couple thousand in a directory, it should not affect things at all. 如果将一个庞大的文件全部放在一个目录中,这可能会稍微影响该目录中文件操作的操作系统性能,但是如果将文件扩展到一个目录中的文件数不超过数千个,则这根本不会影响任何事情。

The amount of data your app actually reads and writes to the hard disk has a lot to do with the app's performance. 您的应用程序实际读取和写入硬盘的数据量与应用程序的性能有很大关系。 So, if these are static files that your server is asked to serve at high volume and you're comparing that situation to one where the files are hosted elsewhere and served by some other infrastructure (like S3), then that does make a difference. 因此,如果要求服务器大量提供这些静态文件,并且将这种情况与文件托管在其他位置并由其他一些基础结构(例如S3)提供服务的情况进行了比较,则确实有所不同。 Serving static files is a pretty simple operation so you could always just put something like NGINX in front of your web server to handle the serving of static files very efficiently if needed. 提供静态文件是一个非常简单的操作,因此您总是可以在Web服务器前放置类似NGINX之类的东西,以在需要时非常有效地处理静态文件的提供。

What are the potential downsides of storing huge amount of static content within the app? 在应用程序内存储大量静态内容的潜在弊端是什么?

Presumably, you don't really mean "within the app", but rather you mean "on the local hard drive". 大概,您并不是真正的意思是“在应用程序内”,而是您的意思是“在本地硬盘上”。 As long as the only server process that needs to get access to these files is on the local machine, then there is really no downside. 只要需要访问这些文件的唯一服务器进程在本地计算机上,那么实际上就没有任何缺点。 You will want to make sure that there is some sort of backup/redundancy solution for the local hard drive since it contains a lot of important data. 您将要确保本地硬盘具有某种备份/冗余解决方案,因为它包含许多重要数据。 Storing the data on a service like S3 will often times take care of the backup and redundancy for you (or you can easily enable such features). 将数据存储在S3之类的服务上通常会为您处理备份和冗余(或者您可以轻松启用此类功能)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM