Evaluating FAMP server performance

I recently moved dalescott.net from a bare metal server to a $5/month DigitalOcean droplet (512MB Memory, 1 Core Processor, 20GB SSD Disk). Afterwards, I wanted to get a measure of server performance. A quick web search came up with some candidates:

  1. Load Impact, claiming “The leading on-demand load and performance testing software-as-a-service.”
  2. Neustar, who claims “We started it all. And we continue to shape the industry.”
  3. WebPageTest, created by AOL for internal use before being open-sourced and now primarily developed and supported by Google.

There are more, but these will be enough to get started with. I had wanted to include Blitz.io, which was referenced in a blog post by Ryan Frankell on using Apache on a small DigitalOcean droplet . However, I couldn’t find any free evaluation capability, and Blitz’s demo is hard-coded to use a Blitz demo site, which eliminated Blitz from consideration.

Tuning Apache

The first step was to tune Apache. 512MB of RAM is low by server standards and also Apache’s default configuration. Some tuning is needed to keep Apache operating in the available RAM, otherwise Apache will gradually consume everything, including swap, and eventually the kernel will start thrashing.

KeepAlive

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

The FreeBSD apache24 port already sets these as defaults in /usr/local/etc/apache24/extra/httpd-default.conf  (the default MaxKeepAliveRequests is even lower than the recommended 200).

References

MPM-Prefork

Although Event is reportedly the default MPM in Apache 2.4, Prefork is still the default on FreeBSD 10.x for compatibility with non-thread-safe php/perl/python modules.

MaxRequestWorkers and MaxConnectionsPerChild must be lowered in /usr/local/etc/apache24/extra/httpd-mpm.conf, and the Include line for httpd-mpm.conf in usr/local/etc/apache24/httpd.conf must be un-commented (and Apache restarted).

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: min number of server processes which are kept spare
# MaxSpareServers: max number of server processes which are kept spare
# MaxRequestWorkers: max number of server processes allowed to start
# MaxConnectionsPerChild: max num of connections a server process serves
# before terminating
#
#<IfModule mpm_prefork_module>
#    StartServers 5
#    MinSpareServers 5
#    MaxSpareServers 10
#    MaxRequestWorkers 250
#    MaxConnectionsPerChild 0
#</IfModule>

<IfModule mpm_prefork_module>
 StartServers 5
 MinSpareServers 5
 MaxSpareServers 10
# reduce max number of server processes to not exceed physical memory
# called "MaxClients" prior to v2.3.13 (MaxClients is still supported)
# - uses cache under load when 25
# - appears to not use cache under load when 12
 MaxRequestWorkers 12
# reduce max connections per child to avoid idle processes from holding onto memory
# - memory use seems stable when 200 but could be lower than optimal
# MaxConnectionsPerChild 350
 MaxConnectionsPerChild 200
</IfModule>

References

Load Impact

I first used the free no-login-required test, which loads 25 Virtual Users in 5 minutes, but by creating a free login profile you are allowed 5 (QTY)-five minute tests (executions) up to 100 VUs per month. Here are the results of the Load Impact test with Apache tuned, showing load times in the low seconds for up to 15 users. This can likely be further improved, but the server is stable and adequate for the expected amount of traffic.

2016-08-12 LoadImpact test results

 

Neustar

Neustar queued three servers for testing, but the Washington server never ran. Here are the results when I gave up waiting.

image

WebPageTest

WebPageTest concentrates on measuring how fast it takes a page to load, and gives lots of information for digging into the load times for each aspect of the page. I was looking for more of a general load or stress test to see if my server will fail under load, but the information can be valuable none the less.

image

Server Performance

Here are the result of top while the Load Impact no-login (20 VU) test is running. Although the server can by no means be considered fast, it also is not exhausting swap and stalling. I’m pleased for now, and will be back to review when time permits.

top-load-test-during

 

Sub-1 GHz Wireless IoT Sensor Network

I have been investigating “Sub-1 GHz Wireless” (also known as “the 900 MHz ISM band”) for a new product proof-of-concept. The use-case is a network of 5 to 50 sensor nodes that send data to a hub node, where it is stored temporarily on an SD card and then transmitted over WiFi to an internet server for archiving, analysis, and reporting. The wireless technology needs to have a range of 2 to 3 km (sensor-to-hub or sensor-to-sensor), and very low power for a sensor node to have 1+ year operation using a CR2016 or AA primary cell. The hub node does not have the same power limitation, and can be always-on.

I will present the sensor and hub node hardware and software in this post, and in a subsequent post the cloud service that stores, processes and reports on the sensor data.

Sensor-Node Hardware

I’ll admit I’m somewhat of a TI fanboy at the moment, working with TI’s new 32-bit ARM Cortex M4-F development system now for several months. Although I don’t have many other recent comparison points, the experience was trouble-free and has given me no reason to switch from low-cost development boards with integrated debugging, an excellent software development environment, and business-friendly BSD-licensed support software. Consequently I looked first at devices with LaunchPad / BoosterPack support.

I decided to use a Sub-1 GHz transceiver for the best compromise between range and power consumption. Although the choice may have been somewhat arbitrary and naive, not considering such factors such as modulation technique, allowed transmit power, and antenna design, it allowed development to continue and is still the right choice. Sometimes an exhaustive analysis also means never releasing product, which doesn’t help anyone.

Perhaps fortuitously, the only Sub-1 GHz transceiver BoosterPack is the 430Boost-CC110L, which uses the Anaren A110LR09x, a certified FCC/IC/ETSI-compliant module containing a TI CC110L together with a PCB antenna. The CC110L BoosterPack has been available since December 2011, and is currently available in-stock from Digi-Key for $25 (a quick supply chain test). I have also received assurances from Anaren that their customers demand long lifetimes and the A110LR09x will be available for many years to come. As additional risk mitigation, the CC110L is a cost and feature-reduced version of the TI CC1101, which is also available from Anaren in a certified module, should a higher performance device become necessary, or should any supply issues arise (although unfortunately the CC1101 is only FCC/IC certified at this time).

Sensor-Node Software

The 430Boost-CC110L is provided with BoosterStack LITE, an application for the MSP430G2553 MPU. BoosterStack LITE was reportedly derived from the TI SimpliciTI stack to create a light-weight, single-channel protocol to demonstrate creating a simple star network, presumably removing features to be compatible with the MSP430G2553. For new applications, Anaren recommends using the Anaren BaseLink driver library (instead of modifying BoosterStack). However, I don’t understand yet how BaseLink relates to SimpliciTI, and whether a SimpliciTI-based networking would sit on top of BaseLink, the other way round, or if BaseLink is effectively included in SimpliciTI. For a more fully-featured protocol, Anaren recommends simply using SimpliciTI.

I need to build at least a minimal stack for software technology option before deciding which to proceed with.

Anaren BoosterStack LITE

  • Provided by Anaren with the 430Boost-CC110L as a demo app using the TI MSP430G2553 MPU.
  • Allows creation of a 3-node network (two sensors and one hub node) compiling with mspgcc, or a 5-node network (four sensors and one hub node) if compiling with IAR. I’m anticipating using a TI MSP432 32-bit ARM processor for production, which should alleviate any practical node limitation.
  • Anaren also provide a PC-based GUI – Air Traffic Control (ATC), but unfortunately ATC is missing features like data logging, and source code is not available.
  • BoosterStack LITE was reportedly derived from the TI SimpliciTI stack to create a light-weight, single-channel protocol to demonstrate creating a simple star network, and presumably was cut-back in order to use a low-cost MSP432 MPU. The source appears to depend on binary library (mspgcc and IAR versions are provided), but it is not clear if the library source is available.
  • Anaren recommends new applications use the Anaren BaseLink driver library.
  • For browsing convenience, I have created a GitHub repo with the BoosterStackLite source (https://github.com/dalers/airboosterstack).

TI SimpliciTI

SimpliciTI™ is a low-power RF protocol aimed at simple, small RF networks. It is open-source software, intended as the basis for building a network with battery-operated devices using a TI low-power RF System-on-Chip (SoC) or an MSP430 ultra-low-power MCU and TI RF transceiver.

LarsRF

LarsRF is a simple RF library for a TI MSP430G2553 LaunchPad and CC110L RF Boosterpack, using the low-level TI SLA3325 library for interfacing to the CC1101. It is BSD licensed in intent, although restricted to TI MPUs and wireless transceiver devices.

Phase 1 MSP430 Node

In Phase 1, the 430Boost-CC110L out-of-box demo application is evaluated using the provided pre-programmed MSP430G2553 MPUs (and two MSP-EXP430G2 LaunchPads) in a two-node network (one sensor node and one hub node).

Although the pre-programmed MSP430G2553 MPUs provided with the 430Boost-CC110L Sub-1 GHz transceiver BoosterPacks support a five-node network, the network is effectively constrained to three nodes when the executable is compiled from source using mspgcc (which must be done to use any sensor other than the MSP430 on-chip temperature sensor). Since the use-case requires a network of five to fifty nodes, as well as SD local data storage and internet connectivity, in Phase 2 the MSP430 MPU will be upgraded to an MSP432. 

CC110L_proto1_IMG_0449
Figure 1 – MSP-EXP430G2553 LaunchPad with 430Boost-CC110L.
CC110L_proto1_IMG_0450
Figure 2 – Using a Pelican Case for Environmental Protection.
CC110L_proto1_IMG_0451
Figure 3 – Ready for the Rain!
Figure 4 - PC Air Traffic Controller GUI showing initial testing with a 2-node network (one hub node and one sensor node).
Figure 4 – PC GUI (Anaren Air Traffic Controller) showing a 2-node network.

Phase 2 MSP432 Node

In Phase 2, the MSP430 MPU will be upgraded to a 32-bit MSP432P401R (with 64 Kbytes RAM and 256 Kbytes non-volatile memory) to support more than three nodes, as well as local SD data storage and WiFi internet connectivity.

Figure 5 MSP432 LaunchPad with SD card BoosterPack and 430Boost-CC110L
Figure 5 MSP432 LaunchPad with SD card BoosterPack and 430Boost-CC110L.

Using GTKWave and DatPlot to View Time Series Data

Sensor-based IoT devices often measure attributes of their environment, such as temperature, battery voltage, signal strength, etc. This data can be presented as a time series, which is a sequence of values obtained at successive points in time. The time between values may be fixed, such as every 1 ms, or it may be irregular or event-driven, such as only times when the value exceeded some threshold.

Many times it can be instructive to view time series data graphically to more readily perceive “the big picture”. Time series data can be plotted using a spreadsheet program (e.g. Excel®) or general purpose numerical analysis application (e.g. R and MATLAB®-compatible GNU Octave). However, a domain-specific program can focus on the job at hand and be more effective.

I naively first thought there would be no shortage of open-source or free-for-use applications to select from, but web searching proved that was not the case. When my eyes started to blur, only GTKWave and DatPlot appeared potentially suitable.

GTKWave

GTKWave was originally developed for viewing Verilog digital-only circuit simulations, although it now can also display real-valued signals. GTKWave will read Verilog VCD/EVCD format files, as well as LXT, LXT2, VZT, FST, and GHW formats. It is provided under the GPL open-source license, and is cross-platform (BSD/Linux, 32-bit Windows®, and OS X®).

GTKWave supports dynamic zooming and panning, has a time marker to display values at a specific time, and can be used with datafiles too large to fit into memory without loss of usability. It is also possible to use GTKWave with streaming data instead of a static input file. However, GTKWave will not read simple delimited text data, such as a CSV-format file. Also, while the vertical axis scales automatically based on the value range of a signal, the scale is not labelled and cannot be set manually.

Based on the user manual and provided data files, GTKWave appears to be useable with a large number of signals and very large data sets. The following screenshot shows the magnetic field around a small toroidal magnet.

tlv493-arduino-02-gtkwave

DatPlot

DatPlot was developed by an aerospace engineer as a better solution for visualizing flight test. The DatPlot tagline is From raw data to report ready plots in under five minutes. Like GTKWave, DatPlot supports dynamic zooming and panning and the vertical plot axis scales automatically like GTKWave, but unlike GTKWave the vertical axis is labelled and an arbitrary number of time markers (called Event Lines) can be displayed. In addition, DatPlot supports annotations which can be used to improve clarity. DatPlot is not open-source, although it is still free to use.

I have not yet been able to explore the usability of DatPlot with a large number of signals (Data Curves) or with very large data sets. The following screenshot again shows the 3D magnetic field around a small toroidal magnet (although not the same dataset shown by GTKWave).

tlv493-arduino-03-datplot

Summary

While GTKWave showed promise based on support for very large data sets, and for being open-source, its lack of vertical scale ultimately made it unacceptable for my immediate use case. GTKWave’s lack of support for simple delimited text files was only a minor inconvenience, as it was not difficult to write data values to a VCD-format data file.

DatPlot does what it claims to do, and is a nice compromise between static graph creation and interactive analysis. I will continue using DatPlot, but a few additional features would really make it shine.

  • Paging quickly forwards and backwards in time (e.g. by holding down Page Up or Page Down keys, instead of only being able to drag left or right in a Graph Pane).
  • Display a specific time in a dataset (instead of dragging to the desired point).
  • Support for CLI operation (e.g. using command parameters or a parameter file to specify source data file, desired Graph Panes and Data Curves, and output image file name).

Epilogue

During my research into a time series data viewing, I came across ROS.org (Robot Operating System). ROS uses bag files to store serialized ROS message data, and provides rqt_bag and rqt_plot utilities to view the data, including plotting fields on a graph. Embedded systems in general (not just robots) often need to store system messages for debugging or forensic analysis, and using the existing ROS bag-file and utilities could save significant effort compared to developing a similar system from scratch.

BitScope DSO QuickRef

I started using my BitScope BS100U again lately to test the I2C and SPI interfaces in a new project, but it had been a while since I’d used it and I actually had to crack the user manual. Ouch!

Here’s a QuickRef guide I created for BitScope DSO v2.9 while working through the manual. Please let me know if you find it useful, or if you think anything is missing. I will post the Microsoft Visio 2010 source file if there is interest.

 

BitScope DSO 2.9 QuickRef (Dale Scott)

 

I might also make a QuickRef for BitScope Logic, although Logic is considerably simpler than DSO (the error I seem to make is forgetting to set the trigger level for the clock channel).

Cheers!