HomeBlog|Subscribe
Published on November 16, 2017

Load Testing an ESP8266

ESP8266 is a really cheap WiFi module with a built-in TCP/IP stack. Basically, you can program it just like an Arduino. It works, but I was not quite sure about the reliability nor the performance of it.
Therefore, I decided to do a load test.

Test Case

Unlike a normal CPU, the processor of an ESP8266 (or any microcontroller) always runs at 100% unless it's sleeping. So the goal of this load test is not to test the CPU performance, but to measure the strength of its WiFi capabilities.
In this test case, the ESP8266 is serving a huge file around 1TB to any client who connects to it. We are using ESP8266's Arduino C++ API for this.

Test Client

Even though we are downloading the file via the local network, I didn't want to download and save a huge file on my laptop. So I just wrote a simple Node.js http client to get the download speed without saving any data.

Test Setup

I uploaded this code to my ESP8266 via the Arduino IDE. My ESP8226 is a generic ESP-12F chip with a custom made dev board.
When uploading the code, I've set the clock speed to 160 MHz to get the maximum output from the ESP8266.
My WiFi access point is 2 meters away from the dev board and separated by a wall. I could download up to 3 mega-bytes per sec from the Internet using my laptop (This is the maximum speed of my ISP).
It's the same laptop as my test client and it's just a few inches from my ESP8266.

Result

So, I started the client and ran it for 3 days. Here are the result.
NOTE: All of the download speed numbers are in Killo Bytes Per Seconds (kBps).
First of all, let me show you the time series chart of the download speed data I collected.
Just by looking at it, you can see that it was performing really well. It has some drops and that could be a slowdown in the ESP8266 or something with my WiFi setup (which is not very reliable).
This is the histogram of the whole data points:
Here's a set of summary statistics:
  • mean - 488
  • standard deviation - 87
  • 5th percentile - 341
  • 25th percentile - 440
  • 25th percentile(median) - 490
  • 75th percentile - 550

Conclusion

This is a really good result.
It delivered more than 341 kilo bytes/sec (2.7 mega bits/sec) for 95% of the time for a range of 3 days. That's a very impressive result for a cheap WiFi module.
In a real world ESP8266 project, I would never want to transfer this amount of data over WiFi. Therefore. this is more than enough for me.
I could load test for a few other cases, like the number of connections per second or WiFi range. But I am now pretty confident with the module.
I'll go ahead with a real-world project and test the performance with that.