RAM
RAM (Random Access Memory) is a working space in servers, computers, programs, and software in general. Its main purpose is to exchange information between the operating system, software, processor, and other devices. Information executed by computer units such as the processor is loaded into this memory.
Its existence is necessary so that the CPU does not have to collect and write information directly to the hard drive, thereby speeding up the delivery and writing of content to your server. Thus, from being an accessory component to operation, it has become vitally important for the performance of a device.
The purpose of RAM is to store information so that the actions you perform on your computer or server are as fast as possible, so as not to directly access the hard drive.
Why is random (random access memory)? Because you can write or read with the same waiting times for any position, in order to access said information as quickly as possible.
RAM SWAP
Ram SWAP complements the operation of traditional RAM. SWAP's job is to store temporary information, reducing RAM usage. If you properly combine the use of your RAM and SWAP memory, you can obtain optimal results compared to what the server can normally offer you.
Swap would then correspond to an available swap space on the hard drive that stores the processes you run in images, reducing RAM usage and optimizing its operation.
When a server or VPS runs, the operating system looks for a low-activity process and moves it to the swap area, freeing up space in main memory to load new processes. When it is needed again, these temporary images are used and loaded back into main memory.
RAM SWAP and RAM
Making a comparison makes no sense since they are complementary entities. SWAP is necessary to hibernate or suspend a computer, for example.
SWAP is much slower than RAM, since its function is different (storing and retrieving temporary data on the hard drive).
SWAPINESS: How do I know when I'm using SWAP?
Linux distributions use a default swappiness of 60%. This means that SWAP memory doesn't come into play until 60% of normal RAM is in use. 60% would then represent the limit at which your server, computer, or VPS would use SWAP.
You can modify this value by editing the following file:
> /proc/sys/vm/swappiness
RAM Perspective
Over the years, like all technology, software development has required RAM to improve its speed and latency times.