•February 7th 2018
There are many feed use cases where it’s important to show updates in real-time. If a feed has thousands or even millions of followers, this can be pretty hard to do. Over the past months, our team has vastly improved the capacity of our real-time infrastructure, allowing you to:
- Show live activities for a sporting event
- Organize raids in a video game
- Notify a user about something important
- Enable discussions between several famous or popular users
- Announce a concert that’s going on sale (follow The Weeknd on Bandsintown)
- Share the latest VR for cats app on Product Hunt (Product Hunt uses Stream)
The metric that matters the most in the examples above is the round-trip time for an activity insert. More specifically, inserting the activity, handling the fanout of notifications, and the latency back to your infrastructure using either websockets, SQS or webhooks. It’s important to note that Stream only fires the real-time event after the insert and fanout are fully completed. This prevents scenarios where your user opens the app from a notification but the activity isn’t there yet.
In the past, our Python-based infrastructure could take up to 2 minutes for a feed update to propagate and for your user to receive the notification. With our new real-time infrastructure, the average round-trip time (including network latency) is around 230 milliseconds. The 99th percentile is 550 milliseconds.
Several recent changes to Stream have enabled this increase in speed. First, our team has made a major migration from Python to Go. You can read more about our Go based infrastructure on StackShare. The second is rewriting our real-time infrastructure from Node to Go.
We’re considering adding socket.io support to our real-time infrastructure. This will make it easier to connect to Stream from various platforms such as iOS, Android and React-Native. The team is also working on additional performance improvements, so we suspect the 99th percentile will further improve in the coming months.
We are excited to see what you can build with faster real-time updates. As always, please contact us if you have any feature requests or recommendations.