Load testing HTTP webserver

  • Hello
    I'm new with nodejs and microchip programming
    I'm trying to stress test the ESP32 Rover with HTML queries
    I have tested it using a simple auto refresh web page using dozens of browser tabs, its works without issues even after hundreds of thousands of concurrent requests, I just need to monitor memory use and manually call the GC when needed. But now id like to use a more robust tool, Apache Bench (ab)
    I'm using this command line
    ab -n 20 -c 1 meaning 20 consecutive query to (no concurrent query, -c 1)
    Now for some reasons, it hang at call number 12, everytime.... I get no error message and memory is fine. Do someone have any ideas/lead how to troubleshoot this, why is no error being caught ?


    Here the sample code

    var http = require('http');
    const low = require("lowsys");
    var os = require('os');

    connections = 0;

    var webport = process.env.PORT || 81;

    var server = http.createServer(function (req, res) {
    console.log("Connection count:"+connections);
    res.writeHead(200, { 'Content-Type': 'text/html' });
    res.end('<HTML><head><meta http-equiv="refresh" content="2"><B style="color:red">Hello</B><HR>'+os.freemem()+'<HR>'+connections+'</HTML>');
    if (os.freemem()<1000000) {

    server.on('error', function (e) {

    process.on('uncaughtException', function( err ) {


  • Hello Louis,
    thank you for reporting this!
    Actually you are reporting 2 things at once: The failure of the stress test, and that you have to call gc(). Both should be fixed.
    Working on it, having some progress. Will write when there is a new version to try.

  • Thanks for your reply, I'll wait for your next release

    also, I'm not sure that
    has any impact


  • server.maxConnections is not implemented.

    But, the stress test should work now! Can you flash the newest version and retry?

    Please note that reconnecting to IDE or calling lowsync does not work during the test. The reason for this is that ab uses all available sockets (even though it is concurrent, low.js is not fast enough to free the old sockets, they get freed as soon as the load is gone). So this is not a bug.


  • Hello
    Unfortunately, it hangs at try number 12 like before... (ab -n 20
    The LowJS version is 1.4.8, is that the latest ? I did a reflash
    lowsync --flash --port=com3 --init

    When it hangs, sometimes it comes back automatically after a few seconds sometimes I have to reset the MC to get control back. I'm browsing the forums, it might be related to the maximum simultaneous sockets that are available. That's why I was looking for a way to limit the number of connections.

    or maybe my dev board is of poor quality, I'll make sure to test the Neonious one when I get it..


  • Hello,
    yes, the problem that you cannot connect is the max no of sockets used as I wrote.
    Implementing server.maxConnections is a second step to make that lowsync/IDE is still working, for now I want to make sure that ab does not hang.
    It worked till 1500 connections (did not try more) yesterday with the debug version, will check in the next few days with the release version to see where the difference is.

  • I finally had time to test.
    Here it is working well in the release version, too...

    Here I called ab and after a while stopped via Ctrl-C. low.js seems to do requests well.

    Thomass-MacBook-Pro:test t.rogg$  ab -n 1000 -c 1
    This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    Benchmarking (be patient)
    Server Software:        
    Server Hostname:
    Server Port:            81
    Document Path:          /
    Document Length:        104 bytes
    Concurrency Level:      1
    Time taken for tests:   17.982 seconds
    Complete requests:      65
    Failed requests:        1
       (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
    Total transferred:      10854 bytes
    HTML transferred:       6759 bytes
    Requests per second:    3.61 [#/sec] (mean)
    Time per request:       276.641 [ms] (mean)
    Time per request:       276.641 [ms] (mean, across all concurrent requests)
    Transfer rate:          0.59 [Kbytes/sec] received
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        2    4   2.9      3      24
    Processing:   156  272 134.5    205     811
    Waiting:      125  235 132.7    171     783
    Total:        158  276 134.7    208     813
    Percentage of the requests served within a certain time (ms)
      50%    207
      66%    228
      75%    369
      80%    393
      90%    446
      95%    465
      98%    633
      99%    813
     100%    813 (longest request)
    Thomass-MacBook-Pro:test t.rogg$

    So what is different with your setup? Windows maybe? Or did the reflash maybe not really happen?

  • Hello
    Since I updated the firmware, I do see a major improvement, I'm now able to run around 80 requests without crashing every time, at n=100 works every two times. When it crashes, I have to restart the MC.

    Now, I'm looking at your output above, and the result only shows 65 completed requests out of 1000, try leaving it run to completion, it will either complete or timeout....

    thanks for your help

  • The next version is a bigger one which includes a new file system (LittleFS instead of SPIFFS, 8x speed with files). Because of testing, I believe it will be online earliest on Tuesday. It will hopefully include the fix.

  • The new version is online! Do you want to try it out?

Log in to reply