June 3 2023

Improve performance and safeguard SSD and nVME disks thanks to the use of RAM

Leveraging the Power of RAM to Optimize the Performance and Longevity of SSD and nVME Disks through Useful Best Practices.

The need for speed and resiliency in the server world

In an age where technology permeates every aspect of daily and professional life, server efficiency and speed have become critically important issues. This is reflected in the growing demand for ultra-fast MySQL queries, real-time script processing, and instant file access with minimal latency and high throughput. Every microsecond counts when it comes to server performance, with businesses continually looking for ways to optimize response times and ensure impeccable service.

Alongside this need for performance, there is a growing need for data storage. The amount of data being generated and consumed is steadily increasing, at a rate that seems almost unstoppable. With an ever-increasing volume of concurrent requests, the performance load on hard drives increases exponentially. This relentless influx of demands can put a strain on hard drives as they try to keep pace without compromising speed or data security.

However, the large number of disk-level read operations can, over time, lead to a deterioration in their proper functioning. This could turn into a point of weakness within the overall resilience of the IT infrastructure, possibly negatively impacting the continuity of business operations.

To respond to these challenges, the technology industry has developed cutting-edge solutions that combine speed and reliability. Among these, a leading role is played by solid state memories: SSD disks and nVME disks. These technologies represent a significant qualitative leap over traditional hard drives, promising faster data access speeds and greater wear resistance. Yet, as we shall see, even these advanced devices have their limitations and require careful handling to make the most of their potential.

SSD and nVME: A leap in quality with limits that should not be underestimated

SSD (Solid State Drive) and nVME (Non-Volatile Memory Express) disks represent a giant leap in data storage technology compared to traditional hard drives. These solid state memory devices have revolutionized the computing industry, bringing outstanding performance in terms of read and write speed, reliability and endurance.

SSDs, in particular, have a totally different structure from mechanical hard drives. Instead of relying on spinning platters and mechanical read/write heads, SSDs use solid-state memory cells to store data. This eliminates mechanical lag, dramatically increasing data read and write speeds.

Even more advanced, nVME drives take advantage of the Peripheral Component Interconnect Express (PCIe) interface to connect directly to the computer's processor. This completely bypasses the SATA (Serial ATA) interface used by traditional SSDs and hard drives, allowing for even faster data transfer speeds.

Despite the indisputable advantages of these solid state drives, it is important to remember that they are not free from limitations. Like any storage device, SSDs and nVMEs also have a physical limit on the number of read and write cycles they can handle. This limit is referred to as TBW (Terabyte Written) and represents the total amount of data that can be written to the disk before performance or reliability problems can begin to appear.

For example, a flagship nVME drive like the Samsung 980 PRO offers an estimated lifespan of 600 TBW. This means that, theoretically, it could write 600 terabytes of data before its reliability starts to decline. This may seem like a huge number, and indeed it is, but in a high-traffic server environment where large volumes of data are read and written every day, this limit can be reached faster than one might think.

The RAM: Speed ​​and performance at a higher level

When it comes to speed and performance in the server world, one hardware component that emerges as a real game changer is RAM (Random Access Memory). This form of volatile memory plays a crucial role in optimizing server performance, boosting performance to truly impressive levels, especially with the arrival of DDR4 and, more recently, DDR5 memory.

DDR4 and DDR5 memory are the evolution of the previous DDR3, offering significantly higher data transfer speeds. This allows for higher bandwidth and therefore higher data processing speed. When it comes to performance, these types of RAM currently represent the pinnacle of memory technology.

To give an idea of ​​the speed difference, let's consider this comparison. A very fast nVME drive can achieve read/write speeds of up to 7000MB/s. On the other hand, a DDR5 memory can reach a speed of 6400MT/s (Mega Transfers per second). However, this value does not directly represent the data transfer rate as is the case with nVME. In reality, thanks to the internal structure of the RAM that allows data transfers in both directions simultaneously, this speed translates into a bandwidth of 51.2 GB/s. This means that DDR5 can handle nearly seven times the data throughput of an nVME disk.

Here, then, is where the potential of RAM emerges. But how can this incredible speed be exploited to improve server performance and, at the same time, reduce the number of unnecessary disk accesses, thus safeguarding the longevity of SSD and nVME? The answer lies in the use of clever strategies and advanced techniques, including the use of mount options such as noatime and nodoratime and the use of tmpfs to create "partitions" in RAM. Let's explore these topics in more detail.

The Mounting Options noatime and nodoratime

A well-configured Linux operating system can make a big difference in improving server performance and the longevity of SSDs and nVMEs. Among the many techniques available, the use of noatime and noderatime mounting options is a very effective solution.

These two attributes, noatime and nodoratime, can be set in the Linux fstab file system. The fstab file is a crucial element of the operating system, as it contains information about how the system should mount disk partitions. By changing the options in this file, you can optimize disk performance and reduce wear.

noatime knotiratime

The noatime option is particularly useful. When enabled, disables automatic updating of the last access time each time a file is read. On a Linux system by default, every time a file is read, the system updates the time of the last access to that file. While in certain contexts this information may be useful, in many scenarios, such as a web server, it may be superfluous and lead to unnecessary write access to the disk.

Similarly, the nodoratime option disables updating of the last access time for directories. Again, this reduces unnecessary write accesses, thus limiting disk wear.

In a context of servers with a high volume of file accesses, using these two options can lead to a significant performance improvement. In fact, reducing the number of writes to the disk frees up a significant amount of system resources, which can then be used for other operations. In addition, reducing disk wear can help extend the life of SSD and nVME disks, which is also a cost-effective solution.

Using tmpfs: A trick to create dynamic "Partitions" in RAM

Another effective strategy to optimize server performance and safeguard the longevity of SSD and nVME disks is the use of tmpfs, a particular feature offered by the Linux kernel. Tmpfs stands for "temporary file system" and is a powerful feature that allows you to create a file system in volatile memory, i.e. in RAM, rather than on the hard disk.

The basic idea is simple but revolutionary: instead of writing and reading data directly from disk, a portion of RAM is used as if it were a disk. This RAM file system is called tmpfs and works exactly like a normal file system, except that the data is stored in RAM instead of on the hard drive. In this way, you can achieve read and write speeds that are much higher than those of any hard disk, SSD or nVME.

Tmpfs is extremely useful for handling data that changes frequently and is temporary. For example, tmpfs can be used for caching a web server or for creating temporary tables in MySQL. In these situations, tmpfs can provide significant acceleration of read and write operations, helping to significantly improve server performance.

Additionally, using tmpfs reduces the amount of writes to the hard drive, helping to safeguard the longevity of SSDs and nVMEs. This is especially important in write-heavy environments, such as large databases or high-traffic web servers.

Let's take as an example the creation of a cache for an NGINX WebServer. Creating a mount point in tmpfs for the NGINX cache can significantly improve server performance. Here is an example of how it could be configured:

# Add this line to /etc/fstab tmpfs /var/cache/nginx tmpfs defaults,size=1G 0 0 # Mount the new file system mount /var/cache/nginx

In this example, a 1GB tmpfs filesystem is created for the NGINX cache. This cache resides entirely in RAM, offering much higher performance than a disk.

Conclusions

In the world of technology, server performance and the longevity of storage devices are of paramount importance. The need for speed and resiliency continues to grow, and wise use of RAM can make a difference in both of these areas. By making the best use of volatile memory resources, it is possible not only to improve server performance, but also to preserve the integrity and life of SSD and nVME disks.

The noatime and noderatime mounting options, on the one hand, and the use of tmpfs, on the other, are effective tools in this regard. Thanks to noatime and nodoratime it is possible to significantly reduce the number of useless writes to disks, limiting wear and freeing up precious resources for other operations. On the other hand, tmpfs allows you to create "partitions" in RAM, allowing access to data much faster and more fluid than that offered by any hard disk, SSD or nVME.

However, it is crucial to emphasize that the use of these techniques requires some skill and careful handling. In fact, the implementation of these solutions must be adapted to the specific needs of each system and must take into consideration the balance between available resources and operational needs.

In an ever more demanding and fast world, the opportunity to be able to count on high-performance servers and long-lasting storage devices is an invaluable advantage. The adoption of strategies such as the use of noatime, nodoratime and tmpfs represents a winning move, which can lead to significant benefits both in terms of performance and conservation of storage devices.

In conclusion, RAM is configured not only as an essential component of the system, but also as a precious ally for optimizing performance and preserving the longevity of SSD and nVME disks. As technology advances and performance demands increase, these techniques offer valuable support to meet the challenges of the present and prepare for those of the future.

Do you have doubts? Don't know where to start? Contact us!

We have all the answers to your questions to help you make the right choice.

Chat with us

Chat directly with our presales support.

0256569681

Contact us by phone during office hours 9:30 - 19:30

Contact us online

Open a request directly in the contact area.

INFORMATION

Managed Server Srl is a leading Italian player in providing advanced GNU/Linux system solutions oriented towards high performance. With a low-cost and predictable subscription model, we ensure that our customers have access to advanced technologies in hosting, dedicated servers and cloud services. In addition to this, we offer systems consultancy on Linux systems and specialized maintenance in DBMS, IT Security, Cloud and much more. We stand out for our expertise in hosting leading Open Source CMS such as WordPress, WooCommerce, Drupal, Prestashop, Joomla, OpenCart and Magento, supported by a high-level support and consultancy service suitable for Public Administration, SMEs and any size.

Red Hat, Inc. owns the rights to Red Hat®, RHEL®, RedHat Linux®, and CentOS®; AlmaLinux™ is a trademark of AlmaLinux OS Foundation; Rocky Linux® is a registered trademark of the Rocky Linux Foundation; SUSE® is a registered trademark of SUSE LLC; Canonical Ltd. owns the rights to Ubuntu®; Software in the Public Interest, Inc. holds the rights to Debian®; Linus Torvalds holds the rights to Linux®; FreeBSD® is a registered trademark of The FreeBSD Foundation; NetBSD® is a registered trademark of The NetBSD Foundation; OpenBSD® is a registered trademark of Theo de Raadt. Oracle Corporation owns the rights to Oracle®, MySQL®, and MyRocks®; Percona® is a registered trademark of Percona LLC; MariaDB® is a registered trademark of MariaDB Corporation Ab; REDIS® is a registered trademark of Redis Labs Ltd. F5 Networks, Inc. owns the rights to NGINX® and NGINX Plus®; Varnish® is a registered trademark of Varnish Software AB. Adobe Inc. holds the rights to Magento®; PrestaShop® is a registered trademark of PrestaShop SA; OpenCart® is a registered trademark of OpenCart Limited. Automattic Inc. owns the rights to WordPress®, WooCommerce®, and JetPack®; Open Source Matters, Inc. owns the rights to Joomla®; Dries Buytaert holds the rights to Drupal®. Amazon Web Services, Inc. holds the rights to AWS®; Google LLC holds the rights to Google Cloud™ and Chrome™; Microsoft Corporation holds the rights to Microsoft®, Azure®, and Internet Explorer®; Mozilla Foundation owns the rights to Firefox®. Apache® is a registered trademark of The Apache Software Foundation; PHP® is a registered trademark of the PHP Group. CloudFlare® is a registered trademark of Cloudflare, Inc.; NETSCOUT® is a registered trademark of NETSCOUT Systems Inc.; ElasticSearch®, LogStash®, and Kibana® are registered trademarks of Elastic NV Hetzner Online GmbH owns the rights to Hetzner®; OVHcloud is a registered trademark of OVH Groupe SAS; cPanel®, LLC owns the rights to cPanel®; Plesk® is a registered trademark of Plesk International GmbH; Facebook, Inc. owns the rights to Facebook®. This site is not affiliated, sponsored or otherwise associated with any of the entities mentioned above and does not represent any of these entities in any way. All rights to the brands and product names mentioned are the property of their respective copyright holders. Any other trademarks mentioned belong to their registrants. MANAGED SERVER® is a trademark registered at European level by MANAGED SERVER SRL, Via Enzo Ferrari, 9, 62012 Civitanova Marche (MC), Italy.

Back to top