简体   繁体   中英

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. over time my application grows to contain more than 50k HTMLs, PDFs and images.

  • 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. 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. 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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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