Starting from AOS 5.10.2 and newer, if you run the ‘cluster status’ command, you may see that there is a new service running on the cluster called Xtrim. That service was not present before 5.10.2:
![](https://uploads-us-west-2.insided.com/nutanix-us/attachment/d59222be-ee12-438c-abd9-7fa6b98d0e4f.png)
Xtrim is the service that is going to improve the performance of the cluster. If we look a bit deeper, it improves the write performance by periodically trimming the SSDs. In Nutanix all the disks are passed-through from the host to the CVM and the CVM is managing the disks, so the Xtrim service running on CVMs is doing the trimming of the physical SSDs.
So, what is trim?
TRIM is a command with the help of which the operating system can tell the solid state drive (SSD) which data blocks are no longer needed and can be deleted, or are marked as free for rewriting. In other words, TRIM is a command that helps the operating system know precisely where the data that you want to move or delete is stored. That way, the solid state drive can access only the blocks holding the data. Furthermore, whenever a delete command is issued by the user or the operating system, the TRIM command immediately wipes the pages or blocks where the files are stored. This means that the next time the operating system tries to write new data in that area, it does not have to wait first to delete it.
When you delete some data, it is only logically deleted from the SSD, the physical data stays intact. However, when you write the new data to the same location on the disk, the old data gets removed, then the new data is written to it. That is two operations during the write. With trim, you ensure that the old data is physically wiped from the disks, so when you will write the new data, it will only write the new data and it will be only one operation, so the performance will be better.
How does the Xtrim service work on Nutanix?
It just simply runs the trim command periodically on the SSDs.
Do i need to do anything to enable Xtrim?
No, it is enabled by default as soon as you upgrade the AOS to 5.10.2 or newer.
So, it runs trim operations on the SSDs periodically. Does it have any negative impact on the performance?
No, it does not. We ensure that the rate of those operations is optimal and that it will not have any negative impact. In fact, it will have only positive impact as the next production write after trim will take less time to complete. We also test every approved SSD model and qualify it for the Xtrim service.
Does it work will all SSDs?
No, it works only on the SSDs that are qualified for Xtrim. We need to do testing for all models of the disks and we qualify more of them for Xtrim with every next AOS version. So, make sure that you run the latest AOS, because there will be more SSD models qualified for Xtrim and better performance.
How do i know if it is working or not?
You can check the logs on the CVMs in ~/data/logs/xtrim.log. If you see something like this:
2019-05-26 16:59:06 ERROR svm_trim_service.py:56 There are no partitions to be trimmed. Will sleep for 21600 seconds before checking again
2019-05-26 22:59:06 ERROR svm_trim_service.py:56 There are no partitions to be trimmed. Will sleep for 21600 seconds before checking again
it means that the SSDs in the node are not enabled for trimming yet. Probably, those models will be qualified in a later version.
If you see something like this in the same log:
2020-07-10 13:09:04 INFO svm_trim_service.py:50 Partitions selected for trimming: c{'mount_path': u'/home/nutanix/data/stargate-storage/disks/BTTV310501CY800JGN', 'size': 716686512128L}, {'mount_path': u'/home/nutanix/data/stargate-storage/disks/BTTV312000L8800JGN', 'size': 716686512128L}]
It means that the Xtrim is working on your SSDs.