We will run the two librados applications using the standard Linux time utility to measure how long each run takes:
time sudo ./rados_md5
The preceding command will give the following output:
Let's make sure that the attribute was actually created:
sudo rados -p rbd getxattr LowerObject MD5
The preceding command will give the following output:
Let's delete the object attribute, so we can be certain that the RADOS class correctly creates it when it runs:
sudo rados -p rbd rmxattr LowerObject MD5
And now run the application that performs the MD5 calculation via the RADOS class:
time sudo ./rados_class_md5
The preceding command will give the following output:
As you can see, using the RADOS class method is a lot faster, in fact almost two orders of magnitude faster.
However, let's also confirm that the attribute was created and that the code ran a thousand times:
sudo rados -p rbd getxattr LowerObject MD5
The preceding command will give the following output:
Due to the logging we inserted in the RADOS class, we can also check OSD logs to confirm that the RADOS class did run a thousand times:
When repeating small tasks, the overhead of communication between the client and OSDs really adds up. By moving processing directly to OSD, we can eliminate this.