RallySafe is a vehicle-to-vehicle and vehicle-to-race control safety, timing and tracking system that transmits hazard warnings via in-car units in competitive motor sports events. A small electronic module is embedded into a vehicle, and automatically transmits warnings and vehicle status data from unit to unit and Race Control in realtime. This automatically generates hazard warnings in the event of an accident.
Realtime race data is transferred between the vehicle and the iOS, Android, and web application. In addition to safety, RallySafe also provides two key benefit streams – tracking and timing, also streamed to the client application.
The Need for Realtime Speed
When it comes to vehicle safety, every millisecond counts. Race Control needs to be alerted of an accident as it happens, not five or ten seconds later. The device in the vehicles is a custom embedded system running a Kinetis processor, with onboard GPS, g-force sensors, radio, GSM and satellite communications. The device collects and transfers location data from the vehicle to the client application. If the g-force sensor is triggered in the case of an accident, that data needed to be streamed as quickly as possible.
As a result, RallySafe needed an efficient and reliable way to transfer vehicle location data between the embedded system in the vehicle and the client application in realtime.
Moving High Volumes of Race Data Fast
Data transfer in the RallySafe application goes through two different layers. The first part collects data from the embedded device in the vehicle and sends it to the RallySafe servers. The second part then takes the data from those servers and streams it to the client web or mobile app.
The RallySafe development team originally built out a custom, open source realtime infrastructure to move the data from the servers collecting location, tracking, and timing data to the client application.
“Our infrastructure became too cumbersome, and we knew we needed a distributed, realtime provider. We were using Azure and a small local service provider for hosting. Our main motivation was to reduce the traffic load on our web servers,” said Simon Haines of Status Awareness Systems, makers of RallySafe.
The app was originally built on a model of query table-based updates. However, by the third live RallySafe event, the application outgrew its capacity and the ISP was overloaded, and as a result the entire system crashed. The development team needed a way to offload traffic onto a different system.
To increase both the speed and reliability of the RallySafe application, the development team needed a way to get the immense location data traffic load off of their main application servers.
Instead of relying on query table-based updates, RallySafe moved to a model of streaming data updates between the servers and the client application. With PubNub Data Streams, they could do just that.
“We have two gateways, one for GSM and one for satellite messages. PubNub is used on both, to forward on information to clients connected via our web or mobile apps. These both sit on Windows Azure, so all our PubNub traffic originates from there,” said Jono Rogers, also of Status Awareness Systems.
Speed and reliability were not the only factors that led the RallySafe team to go with PubNub. Ease of implementation was also key, especially because the architectural change came in the middle of racing season, and the dev team needed to get the new realtime infrastructure up and running as quickly as possible.
“We got the system up and running very quickly. We didn’t have a lot of time to spend on implementation, especially in the middle of a racing season. We’re a small team, so it was all hands on deck. The PubNub API was really easy, and quite simple and painless to implement,” said Haines.
Building a Lighter Weight Data Streaming Infrastructure
“It’s been really good for us that we’ve been able to greatly increase our processing capability. We also don’t have to deal with a constant stream of traffic hitting our servers. Those two things have been so valuable for us,” said Haines.
With PubNub, RallySafe was able to significantly reduce the traffic load on their main application servers, particularly with the servers that look after the safety aspect of the race.
Taking the load off the main servers that crunch the safety data, the RallySafe mobile and web applications are kept updating smoothly and seamlessly. In doing so, this insures that location, timing, and tracking data is delivered on time, all the time.
Implementing and building PubNub into their internal infrastructure, RallySafe increased their server capacity, reducing the number of servers and necessary maintenance on those servers.