Communication speed between the Agent and the Device


I did another speed test to complete my research. Maybe this can be useful even for other users.

I created a simple application that runs on the Electric Imp that let the me understand how fast the agent can communicate with the device. Of course it’s an average result but it’s enough to understand what I can do and to get an idea of what I can expect.

The application in the agent side uses an event to call endlessly a function in the device that increments a global counter. Then the device checks every seconds the value of the counter and shows it on the server console.


function Start_Counter()
    local NullPar = 0;
    for(;;) device.send( "Increment", NullPar );


gCounter <- 0;
function Show_Counter()
    server.log( "The counter is: " + gCounter );
    imp.wakeup( 1, Show_Counter );

function Increment_Counter( DummyPar )

agent.on( "Increment", Increment_Counter );
imp.wakeup( 1, Show_Counter );

The average result was of about 92 increments per second so a frequency around 1 Hz.

The green line is the linear trend that this algorithm should return, and the blue line is instead what the agent really does. I believe that this it’s normal for the nature of the agent.

Hopefully this is interesting and useful for you also.

Note that sending individual messages isn’t giving much of an indication of throughput - this is more a measure of overhead (as a single packet is wrapped, encrypted, and sent immediately, and these are also throttled to some extent within the VM environment).

Also, upstream bandwidth (imp to agent) is severely limited by the small TCP buffer sizes and the buffer-latency product (ie, packets the imp is holding in the stack waiting for a TCP level ACK from the server limit the throughput). You can increase the number of transmit buffers on the imp, see