When to save user data to disk? [closed] - node.js

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've been getting into web applications and node.js lately, and it's obvious that you should write user data to the disk, but when should I? It would be a bit overkill and very resource intensive to write to the disk every time data is updated, so when should you?

I'd recommend creating a temporary memory cache to store user data. (For actively connected users)
Read and write to this memory cache as needed to maintain user sessions / realtime functionality, then write to disk as necessary for persistent data. "Eventual persistence" is an option for avoiding writing to disk very often, but could lead to eventual issues if writes fail.

Related

NodeJS: Download torrent as stream [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
TL;DR Is is possible to proxy torrent larger than available local disk while piping it to outbound stream ?
According to BitTorrent spec , all torrents are stored as pieces of equal length , I want to write a node app could pipe the torrent pieces to a http upload stream , does any library provide such functionality ?
All the implementation I have found downloads the whole file to local storage then propagate it further which can cause problems when running on small disk and large files .
Bittorrent is designed for random access to keep data available via the rarest-first strategy. See Section 2.4.2 of the bittorrent econ paper. While it is possible to operate it in a streaming manner anyway this generally isn't recommended and certainly shouldn't be the default, otherwise performance could severely degrade for all swarm members or content could even become unavailable.

Where to store mp4 files on a node.js server? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am building some kind of video streaming web app using node.js/express and MongoDB. But I am facing an issue related to where to store the mp4 files that my clients will upload to my back-end. I am not sure if MongoDB is capable of storing large files(in the GB order) and my current idea is to keep the files on a directory and then keep track of each file path on MongoDB. Is this a good idea or is there a better method to do so?
My advice, use
s3.amazonaws.com
Yes, it's way better to store only a path inside a MongoDB instead of storing directly the video file inside the DB. Because your DB will grow up so fast if you did that. The disk space taken by both solutions is the same, but overloading your DB with these files will just result in a slower DB result

Modern Web Application - Design [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am building a large web application in node.js and I'm always faced with the question 'where should the heavy lifting be done?' I was always taught that the 'logic' should always be done in the backend of the application, but with modern computers and browsers being so powerful it begs the question if some of the heavy lifting logic can go in the front end.
So context to my specific application. Using angularjs and postgres. A specific question is: would it be a bad practice to have the back end api fetch the rows from the database and pass it to the front end. And then have the front end deal with the logic of deriving the information from the rows? Things like counts with in date ranges and such. (ignore security for this question) or should all the be done on the backend?
If it deals with script that doesn't need to be hidden or is not a secret, then I would suggest putting most of it on the front-end, it would lessen the stress on your server and give you more space to run more processes at a time without filling the ram.

How data can be synchronized among multiple linux servers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have basically 4 servers for running the same project. I want make changes in database from UI.
What should I do so that all changes are reflected on all server so that all servers contain the same data.
You can use replication in database for your purpose.
You can use data replication. replicate all the data from all four servers at one single location.
Database replication is the frequent electronic copying data from a database in one computer or server to a database in another so that all users share the same level of information. The result is a distributed database in which users can access data relevant to their tasks without interfering with the work of others. The implementation of database replication for the purpose of eliminating data ambiguity or inconsistency among users is known as normalization.

Mongo DB - is 1 DB per client really recommended for multi-tenant SAAS? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
this article suggests that using MongoDB for a SAAS application that you should use one DB for each client - can this be right? http://docs.mongohq.com/use-cases/marketing-platforms.html (see bottom of page)
If so are there any occasions when it would still pay to put all clients into one DB?
I asked a similar question
Is it better to use multiple databases when you are managing independent sets of things in MongoDB?
The conclusion seems to be its not really very efficient to have multiple databases. But its still a valid way of doing things.
A more important consideration is if you want to do queries across customers for whatever reason, then your job gets a lot more difficult if they are in separate databases.

Resources