Monday, January 29, 2018

DigitalOcean versus Linode Performance


I've been consistently using Linode since the summer of 2007 for virtual Linux systems. Their support team has been stellar when it comes to promptness and thoroughness. They also tend to hand out nice surprises in the form of disk space and memory around the time of the company's birth date (June 16.) I have been and continue to be a satisfied customer.

Of course, I've also heard of one of their competitors: DigitalOcean. I have historically come across DigitalOcean's various guides during my web sleuthing for a variety of application installation and configuration inquiries. I have found their documentation to be very helpful. Curiosity finally got the best of me a couple of weeks back and I finally created an account. I was also looking at giving Google Cloud a whirl. I have used AWS and Azure in the past, but the nickel-and-dime cloud pricing model has always bothered me. Easy/flat-rate pricing won for now.

Now that I have given DigitalOcean a spin, I figured I would share my impressions of it along with the results of some performance tests I've conducted in comparison to one of my Linode systems.

What I Like About DigitalOcean

Aside from their excellent collection of documentation which I've already mentioned, their web interface is easy to navigate and is quite clean. I was quite excited to see that they offer and support several releases of FreeBSD. This is something I wanted Linode to do for nearly a decade without the hassle of pushing your own custom image to their site. Can you guess what OS I selected for my first droplet? :) A virtual guest instance is referred to as a "droplet" at DigitalOcean by the way! My droplet was ready in under a minute after filling out the hostname and checking various options (IPv6, internal network support, etc.)

One of the first things I did was recompile my kernel. This operation went smoothly. It is also noteworthy to mention that I have maintained an SSH connection to my first droplet for over a week straight. The network seems quite stable (my droplet is hosted in the NYC3 datacenter.) One of the significant advantages I forgot to comment on is that DigitalOcean plans currently offer more disk capacity than equivalent Linode plans. For example, the $20 plan at Linode allows for 48GB of SSD storage whereas the $20 DigitalOcean plan provides a whopping 80GB of SSD storage. This is certainly nothing to scoff at.

Their API looks to be well written. I have not had the opportunity to use it yet. Additionally, I have not had to open a support ticket for anything at this point. I will update this post with my experience should that ever occur. Lastly, DigitalOcean recently announced the release of their object storage service called "spaces". I plan to take advantage of their 2-month trial to see what it is all about very soon. So far, I am liking DigitalOcean quite a bit.

Performance Test Results

Now that the introductory stuff is out of the way, let's get to the real reason why you're probably here... Let's take a look at the specs first.

DigitalOcean Linode
Geographic Region New York City, NY, USA Dallas, TX, USA
Virtualization Technology KVM KVM
Operating System FreeBSD 11.1 64 bit CentOS 7.2 64 bit
CPU Model Intel(R) Xeon(R) CPU E5-2650L v3 Intel(R) Xeon(R) CPU E5-2680 v2
CPU Frequency 1.80GHz 2.80GHz
Core(s) 1 1
Memory 1GB 1GB
Disk Capacity 25GB 20GB
Disk Type SSD SSD
Filesystem ZFS ext4
Ingress ? 40Gbps
Egress ? 1GbE

CPU Benchmark
Up first are the CPU benchmark results using sysbench. The DigitalOcean FreeBSD system is first:
root@vector:/tmp # date; sysbench --test=cpu --cpu-max-prime=20000 run
Sun Jan 28 21:14:48 EST 2018
sysbench 1.0.11 (using system LuaJIT 2.0.5)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:   238.70

General statistics:
    total time:                          10.0008s
    total number of events:              2388

Latency (ms):
         min:                                  3.86
         avg:                                  4.17
         max:                                  9.88
         95th percentile:                      4.91
         sum:                               9968.19

Threads fairness:
    events (avg/stddev):           2388.0000/0.00
    execution time (avg/stddev):   9.9682/0.00

And now, the Linode Linux system:
[root@stack /tmp]# date; sysbench --test=cpu --cpu-max-prime=20000 run
Sun Jan 28 21:19:11 EST 2018
sysbench 1.0.9 (using system LuaJIT 2.0.4)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:   351.07

General statistics:
    total time:                          10.0008s
    total number of events:              3512

Latency (ms):
         min:                                  2.81
         avg:                                  2.85
         max:                                  3.82
         95th percentile:                      2.91
         sum:                               9992.46

Threads fairness:
    events (avg/stddev):           3512.0000/0.00
    execution time (avg/stddev):   9.9925/0.00

Despite DigitalOcean sporting a newer Haswell-based Xeon, Linode's older Ivy Bridge Xeon has a faster clock rate and clearly handles more events per second.

CPU Performance Winner: Linode

Memory Benchmark

This test was performed using a pair of 256M tmpfs RAM-based filesystems. Again, the DigitalOcean FreeBSD system is up first:
root@vector:/mnt # mount -t tmpfs -o size=256m tmpfs /mnt/ramdisk1
root@vector:/mnt # mount -t tmpfs -o size=256m tmpfs /mnt/ramdisk2

root@vector:/mnt # df -h | grep ramdisk
tmpfs                 256M    4.0K    256M     0%    /mnt/ramdisk1
tmpfs                 256M    4.0K    256M     0%    /mnt/ramdisk2

root@vector:/mnt # dd if=/dev/zero of=/mnt/ramdisk1/test bs=1M
dd: /mnt/ramdisk1/test: No space left on device
256+0 records in
255+0 records out
267386880 bytes transferred in 0.154986 secs (1725231326 bytes/sec)

root@vector:/mnt # time cp /mnt/ramdisk1/test /mnt/ramdisk2/test

real    0m1.174s
user    0m0.013s
sys     0m0.509s

root@vector:/mnt # time cmp /mnt/ramdisk1/test /mnt/ramdisk2/test

real    0m1.927s
user    0m0.771s
sys     0m0.135s

And next up is the Linode Linux system:
[root@stack /mnt]# mount -t tmpfs -o size=256m tmpfs /mnt/ramdisk1
[root@stack /mnt]# mount -t tmpfs -o size=256m tmpfs /mnt/ramdisk2

[root@stack /mnt]# df -h | grep ramdisk
tmpfs           256M     0  256M   0% /mnt/ramdisk1
tmpfs           256M     0  256M   0% /mnt/ramdisk2

[root@stack /mnt]# dd if=/dev/zero of=/mnt/ramdisk1/test bs=1M
dd: error writing ‘/mnt/ramdisk1/test’: No space left on device
257+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 0.137701 s, 1.9 GB/s

[root@stack /mnt]# time cp /mnt/ramdisk1/test /mnt/ramdisk2/test

real    0m0.191s
user    0m0.000s
sys     0m0.189s

[root@stack /mnt]# time cmp /mnt/ramdisk1/test /mnt/ramdisk2/test

real    0m0.469s
user    0m0.235s
sys     0m0.232s

The initial memory write times were fairly close between the two providers. The in-memory copy and compare operations were significantly speedier on the Linode as indicated above however.

Memory Performance Winner: Linode

Disk Benchmark

This particular test will use both standard "dd" and sysbench. DigitalOcean FreeBSD system:
root@vector:/tmp # dd if=/dev/zero of=/tmp/test1.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 1.928485 secs (543730518 bytes/sec)

root@vector:/tmp # sysbench --test=fileio --file-total-size=1G prepare
sysbench 1.0.11 (using system LuaJIT 2.0.5)

128 files, 8192Kb each, 1024Mb total
Creating files for the test...
Extra file open flags: 0
1073741824 bytes written in 7.59 seconds (134.86 MiB/sec).

And the Linode Linux system:
[root@stack /tmp]# dd if=/dev/zero of=/tmp/test1.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 0.977575 s, 1.1 GB/s

[root@stack /tmp]# sysbench --test=fileio --file-total-size=1G prepare
sysbench 1.0.9 (using system LuaJIT 2.0.4)

128 files, 8192Kb each, 1024Mb total
Creating files for the test...
Extra file open flags: 0
1073741824 bytes written in 1.73 seconds (591.77 MiB/sec).

Disk Performance Winner: Linode (substantially)

Network Benchmark
In this test, I'll be pulling down a 1GB file using wget from a competitor of both companies, Vultr. I will be using Vultr's Chicago datacenter which is approximately equidistant between Dallas (Linode) and New York City (DigitalOcean) to test download rates. I will then attempt to sftp the same file to a server in my LAN (which is also fairly centralized between both test locations) to test the upstream of both providers. Here are the results from DigitalOcean:
root@vector:/tmp # wget
--2018-01-28 23:10:38--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1048576000 (1000M) [application/octet-stream]
Saving to: ‘’                                        100%[========================================================================================================================================>]   1000M  48.3MB/s    in 22s

2018-01-28 23:11:00 (44.8 MB/s) - ‘’ saved [1048576000/1048576000]
<23:13:20> (~)
[lloyd@lindev] :) > sftp testuser@vector
Connected to vector.
sftp> cd /tmp
sftp> get
Fetching /tmp/ to
/tmp/                       6%   67MB   2.0MB/s   07:56 ETA

The download to my LAN capped out at an even 2MB/sec. Below are the Linode results:
[root@stack /tmp]# wget
--2018-01-28 23:10:45--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1048576000 (1000M) [application/octet-stream]
Saving to: ‘’

100%[=================================================================================================================================================================================================>] 1,048,576,000 97.6MB/s   in 9.8s

2018-01-28 23:10:55 (102 MB/s) - ‘’ saved [1048576000/1048576000]
<23:19:28> (~)
[lloyd@lindev] :) > sftp testuser@stack
Connected to stack.
sftp> cd /tmp
sftp> get
Fetching /tmp/ to
/tmp/                       8%   89MB 978.0KB/s   15:53 ETA

The download to my LAN from Linode in this case never went above 1.1MB/sec. The download from Vultr to Linode was complete in less than half the time as the DigitalOcean transfer.

Network Performance Winner (Download): Linode
Network Performance Winner (Upload): DigitalOcean

*Performance is relative to location and tubing in this context of course!

Final Thoughts

Linode seems to handily outperform DigitalOcean in practically all test cases. Obviously, there are variances within my control which could impact the outcome. Three that come to mind are the platform (FreeBSD vs. Linux), filesystem (ext4 vs. ZFS), and sysbench version (1.0.9 vs. 1.0.11). The filesystem benchmark could potentially be the most affected in this case. However, I highly suspect that Linux on DigitalOcean would yield very similar results.

Would I still recommend and continue to use DigitalOcean? Absolutely -- for the reasons I cited at the beginning of this post. Performance certainly is not everything and DigitalOcean still provides more disk capacity for equivalent pricing along with the option to create a FreeBSD system.

Technology and services are constantly changing. DigitalOcean and Linode will undoubtedly upgrade their hardware and modify their plans again in the future. I hope that any readers found this information insightful.

Edit: I forgot to mention that you can use the following link for a $10 credit at DigitalOcean. This is enough to run a single $10/month or two $5/month instances for 1 month or a single $5 instance for 2 months so you can test drive the service yourself. Enjoy!:

Saturday, January 27, 2018

Nullifying Triglycerides

For folks looking to significantly reduce their triglycerides without fibrate and statin drugs, read on. I often read medical literature for fun. Two of the sources I frequent are Mayo Clinic and National Institutes of Health. I was facing this problem because I have a desk job, my hobbies (gaming and reading) involve sitting, and I love food. Genetics can also play a role. I am hoping that others find this information useful. The key is applying the knowledge.

Allow me to first explain what a triglyceride is for those who do not know. A triglyceride is a type of fat in the blood. The two most common causes of high triglycerides are consuming too many calories and not expending enough calories. Given the causes, we can deduce that people with high triglycerides should:

1.) Eat fewer calories per day. For non-athletic males, 1,800 calories is probably optimal. For non-athletic, non-pregnant, and non-nursing females, 1,600 calories is probably adequate. It is also interesting to note that caloric restriction has been shown in animal models and some human populations to increase longevity ( Going too low is also unhealthy and poses the potential risk of nutritional deficits.

2.) Move more/stop being sedentary. You do not need to run or do anything intense. Even casual walking is beneficial.

I am inclined to believe that even caloric reduction alone would be sufficient enough to reduce triglycerides over time even if sedentary. The convergence of dietary changes and aerobic activity would likely make the goal of triglyceride reduction occur more quickly however.

So, where do triglycerides come from? Aside from excess calories in any form, the largest offenders are refined carbohydrates including pizza dough, white bread, white rice, crackers, anything with sugar (honey, brown sugar, white sugar, brownies, muffins, cupcakes, cookies, etc.), pasta, and fruit juices. If these types of foods are not burned off, the liver stores them for later use. This is a problem as it can lead to non-alcoholic fatty liver disease (NAFLD.) Furthermore, very high levels of circulating triglycerides can induce gallstone formation and pancreatitis.

Aside from the two solutions above, you can also try 1-4g of omega-3 fatty acids per day. A prescription form is available as Lovaza which contains ethyl esters of eicosapentaenoic (EPA) and docosahexaenoic (DHA) acids. I opted for Carlson lemon-flavored fish oil which supplies 1,600mg of omega-3 fatty acids per teaspoon (800mg of EPA and 500mg of DHA) in triglyceride form. One teaspoon in the morning and one at night worked for me. This method, on average, seems to reduce plasma triglycerides by approximately 30% which is quite significant. Pharmacological effects of omega-3 fatty acids on triglycerides:

You can also supplement with 500mg to 1g of vitamin C (ascorbic acid and/or ascorbate) to help retard the oxidization of low-density lipoproteins (LDL) and lower triglycerides per this article:

Lastly, there is vitamin B3 or niacin in the form of nicotinic acid. It must be in the nicotinic acid form considering that nicotinamide/niacinamide nor inositol hexanicotinate will exert the desired effect. The prescription form is Niaspan or Niacor. I was fearful of using this compound as I've experienced the infamous flushing effect in my late teenage years when I was more into supplements. I made the mistake of taking a standalone B3 supplement in the nicotinic acid form while taking a B complex supplement which contained the same form. It was a rather uncomfortable sensation and even triggered a panic attack. I thought I was having an allergic reaction to something. My face had turned a nice shade of red and my skin was burning. My heart rate was also elevated. This is all caused by vasodilation (opening up of capillaries which reduces blood pressure -- the heart needs to beat faster to keep up in response.) The event lasted for approximately 30 minutes. I would never again willingly put myself through that! :)

Aside from reducing triglycerides significantly, nicotinic acid also increases high-density lipoprotein (HDL -- the "good" cholesterol that transports other harmful molecules back to the liver) and reduces LDL (the bad cholesterol.) The flushing effect can be reduced by taking niacin with a meal, taking an aspirin 30 minutes prior, and using extended-release forms.

*Disclaimer: Please note that I am NOT a physician. I am merely a hobbyist who enjoys reading medical journals and published health-related studies. Prior to taking supplements, you should consult a pharmacist and/or doctor to ensure that any supplement will not negatively impact existing health conditions or other prescriptions you take.