-
Changes to Throttling in Adafruit IO
We’re changing throttling in Adafruit IO for the better. We’re moving from a fixed-window, long period throttle rate that can lock out clients for up to 15 minutes in some cases to a rolling-window, short period throttle rate that can reset sooner when clients are well behaved.
In the past, hitting our authentication or data limits could result in a lock on your account for up to 15 minutes. If you’ve ever seen the red bar at the top of your browser window while you’re working on an IoT project, that was most likely a throttle. The short explanation for that is that we were using a fixed-window throttling algorithm that resulted in message bursting when we made the window of time too small. The best solution we had at the time was to make the window longer, which resulted in the 15 minute lock-outs mentioned above.
With our new system, very similar to the one described here, once you’re throttled on authentication or sending data, stopping sending will be guaranteed to reset your throttle in less than 1 minute. The tradeoff is that continuing to send messages at a greater-than-limit rate will cause you to remain throttled forever. Where the old system would let you back in for authentication after 15 minutes, the new system could lock you out forever if you have a large enough collection of misbehaving devices you’re unable to stop.
To avoid being throttled, make sure you set delays on all reconnection attempts of at least 10 seconds and make sure you’re sending at most 1 message per second across all your devices and browser sessions. For example, our Arduino library delays for 60,000 milliseconds between reconnection attempts after it’s been throttled. Client libraries will let you post data as fast as you’d like, so it’s a good idea to keep a subscription to the MQTT
$username/throttle
topic open somewhere you can see it while you’re writing code.Some additional benefits of the new system going forward:
- We can now manage throttling across the MQTT and HTTP APIs.
- We now have a few additional variables we can tweak to make the experience of building an IoT device or application nicer. For example, we can set minimum distances between messages and scale the rate/window to smaller slices (10 messages / 10 seconds rather than 60 / 60). We’ll be keeping an eye on throttling once we’ve deployed the new system.
- Refactoring our throttle logic lets us customize throttle rates across accounts, which will support Adafruit IO paid subscriptions in the future.
It’s tricky to be brief, but we put a lot of thought into changes like this and we like to share. :D
Please speak up on the forums with any questions or thoughts. We’d love to hear how you’re using IO!
-
State of IO 06.15.17
Here are the stats for the past week:
* 84.7 million inserts of logged data in the last 7 days * 29,181 users * 24,509 online feeds (84,764 feeds total)
Since our last State of IO post, we’ve been mostly heads down on new features that aren’t quite ready yet for production. We’ve also made some major performance improvements to our backend that has helped with general system stability.
We’re also responding to issues you may run into on our Adafruit IO Forum. Please post any issues with as much detail as you can. It definitely helps us out when fixing the bugs.
Also, if you’re still using version 1 of our API, you may want to upgrade to the latest version 2. It has more features, and is generally better designed and easier to use than our previous API. The default for our docs is V2 now as well.
-
State of IO 05.16.17
Here are the stats for the past week:
* 80.2 million inserts of logged data in the last 7 days * 27,729 users * 23,248 online feeds (79,685 feeds total)
-
State of IO 04.25.17
Here are the stats for the past week:
* 81.4 million inserts of logged data in the last 7 days * 26,662 users * 22,161 online feeds (75,819 feeds total) * ~132 inserts per second via MQTT * ~10 inserts per second via REST API
-
State of IO 04.05.17
Here are the stats for the past week:
* 75.8 million inserts of logged data in the last 7 days * 25,738 users * 21,038 online feeds (72,237 feeds total) * ~120 inserts per second via MQTT * ~10 inserts per second via REST API