Server load test

· Stefano Chiodino

Load testing a $5 Digitalocean server
#server #nginx #digitalocean #programming

I've recently tried Digitalocean hosting and decided to host this blog on it. I'm running a $5 / month server, or droplet as they call it, with 1 CPU, 512 MB of ram, 20 GB SSD and 1 TB of bandwidth. You even get $10 credit when you sign up, sweet!

You may look down on a $5 machine but I've found it to be more than enough for my need.

I'm serving "static" content that has been generated by Hugo

I recently ran some load testing at work for a newly launched website so I decided to test this $5 server. I've been using loader.io since its basic usage is free.

# The test

The server responds to a certain number of clients every second for a full minute.

The majority of the users must receive the page in < 5 secs. Only the html is loaded.

# Plain HTML

10.000 requests a second! (that is the maximum that loaded.io goes on a free plan)

# Enable strong HTTPS

How strong you say?

As expected enabling https is taking its toll. The server can't accommodate less than half of the requests, "just" 4.000.

# Full on PageSpeed on strong HTTPS

I've then enabled Google's PageSpeed module for Nginx and enabled every performance related filter!

I've enabled 27 extra filters on top of the 34 enabled by default, leaving just 7 out that were just for compatibility or counterproductive, hell I've even enabled the filter to make the G analytics script async when it's already implemented that way.

Result: a quite dramatic 150 clients/sec 😀

Here is the list of filters that I've enabled:

 1pagespeed EnableFilters responsive_images;
 2pagespeed EnableFilters outline_css;
 3pagespeed EnableFilters outline_javascript;
 4pagespeed EnableFilters move_css_above_scripts;
 5pagespeed EnableFilters move_css_to_head;
 6pagespeed EnableFilters rewrite_style_attributes;
 7pagespeed EnableFilters prioritize_critical_css;
 8pagespeed EnableFilters make_google_analytics_async;
 9pagespeed EnableFilters canonicalize_javascript_libraries;
10pagespeed EnableFilters inline_google_font_css;
11pagespeed EnableFilters local_storage_cache;
12pagespeed EnableFilters convert_to_webp_animated;
13pagespeed EnableFilters insert_image_dimensions;
14pagespeed EnableFilters inline_preview_images;
15pagespeed EnableFilters resize_mobile_images;
16pagespeed EnableFilters remove_comments;
17pagespeed EnableFilters collapse_whitespace;
18pagespeed EnableFilters elide_attributes;
19pagespeed EnableFilters extend_cache_pdfs;
20pagespeed EnableFilters sprite_images;
21pagespeed EnableFilters rewrite_domains;
22pagespeed EnableFilters trim_urls;
23pagespeed EnableFilters remove_quotes;
24pagespeed EnableFilters defer_javascript;
25pagespeed EnableFilters dedup_inlined_images;
26pagespeed EnableFilters lazyload_images;
27pagespeed EnableFilters insert_dns_prefetch;

# Brotli (max compression)

Just add Accept-Encoding: br to loader.io request headers and... 75 clients / sec. Not bad considering that I've enabled the maximum (11) level of compression!

..and, if you are curious about the compression, my homepage file sizes are (method from Mozilla's brotli post ):

Algorithm Size
none 9508
gzip 3344
brotli 2732