System Design Series — Storage
All about building robust, functional, and scalable systems.
Hola, in this writeup we gonna cover storage. If you’re going to design some system, that system most probably going to require some storage, maybe you need to store the information or maybe you've to store a matrix to store the system itself, this is where the database comes into play. A database is primarily used for two purposes, to store data and to retrieve data. A database is just a server like can take a computer for example. You can configure your computer to save data, to save files when some other computer or client is going to communicate with it. One of the most important points in a database is persistence. That means if you’re going to reboot your database server or your server crashed because of something, the data should have to present as it was before the crash, and that’s what leads us to persistence. There’s are two different types of storage, memory, and disk. Writing data to a disk is basically saving files into your computer. If you’re even going to reboot your computer or dismantle and reassemble (without any physical damage), the data is going to be still there. If you’re storing data memory, it will be lost once you’re going to close the server program managing database(or files in this context).
Reading data from memory or writing data to memory is comparatively faster than reading or writing to disk.
Let’s create a javascript server.
There are different routes for writing and reading data from disk and memory. The hashtable is something that is going to be in the memory and the fs (filesystem) modules are going to read or write data in the disk. Storage is very complicated, we have only covered the surface of storage.
Thank you :)