AWS Database Blog

Wave: A Private Location App Running on Amazon RDS

by Yoav Eilat | on | in RDS PostgreSQL | | Comments

By Pablo Clemente, CTO, Wave

How many times have you endured the painful process of meeting up with someone and having to constantly text or call them to find out where exactly they are? Doing this is not only inefficient and frustrating, but also a potential danger for anyone who is driving or moving. Recently, several smartphone apps have appeared that are designed to locate your contacts, such as Facebook’s Find My Friends and Google’s Latitude. The Wave app locates your contacts and improves on earlier solutions in a few ways.

 

The App

My company, Wave Application, is a Spanish startup founded in 2014 by Manuel De La Esperanza and Luis Gelado. Today Wave helps more than 7 million users locate their contacts in real time on a private map. Potential uses include meeting friends and family at a music festival or finding your friends when traveling in a new city, at an outdoor sports event, or other occasions. Wave is especially popular in the US, India, Latin America, and Spain. With a new Wave being opened every second and over 2,100,000 monthly active users, Wave is among the most successful apps of its kind.

Some of the neat Wave features I always like to share:

  1. It’s 100% private: You can only be found by the ones you choose, when you choose them. We use end-to-end encryption to ensure that your data is safe at all times.
  2. It’s global: Wave works all over the world in Android and iOS.
  3. Its sharing is limited: To use Wave, you must agree with the other party on how long your location is shared. Once that time expires, you automatically stop sharing your location.
  4. It provides extra features: Alongside viewing your contacts’ positions on a private map, you can also create groups with up to 10 people. You can view their position in real time, chat, set a meeting point, and obtain GPS navigation.

The infrastructure

Wave relies on AWS for server infrastructure and content delivery. As you know, AWS is an extremely scalable, pay-as-you-go system that can accommodate millions of users without the hassle of having to maintain your own hardware. We found AWS to be the best way to achieve a vast, scalable pool of resources that can be triggered on demand with that kind of flexibility. Today Wave uses three Availability Zones for maximum performance and throughput.

We were looking for the same pay-as-you-go, maintenance-free experience for our databases, and Amazon RDS was the solution. It simplifies database maintenance, setup and optimization. It handles the heavy lifting by automatically managing connections, backups, security and updates. Also, with Multi-AZ, we can make changes with no downtime whatsoever. As you can with nearly every AWS product, you can scale up as much as you need and only pay for the resources you use.

Our setup is based on two main AWS Elastic Beanstalk environments. The first is a Python-Django infrastructure, which handles our main API. This environment is associated with two PostgreSQL databases, a master database and a read replica, set up on Amazon RDS. These handle all the creation of Waves and user administration. Our database instances have 2 TB and 3,000 IOPS each allocated to ensure best IOPS performance, because we perform a lot of write operations in our database.

Our second environment uses Erlang and the XMPP framework to provide instant socket-based architecture. This architecture sends your location to your active Waves and handles the chat system.

Why did we choose PostgreSQL?

PostgreSQL shines when handling complicated relations between tables, such as full outer joins. Wave features a vast number of relations, so performance here is key. Additionally, PostgreSQL supports referential integrity to prevent errors and is extremely reliable under high concurrency. Plus, it felt like a natural choice because we are using Python for our API (with the Django REST Framework). Python comes with out-of-the box support and serializers for PostgreSQL.

Our favorite RDS Postgres features are the ability to easily scale up with a click, have zero downtime when executing changes with Multi-AZ, and easily create replicas or shard the database.

Additional challenges

The Wave app is designed to be used on the go. This means it experiences cell carrier changes, transitions from Wi-Fi to data or vice versa, loss of cell reception, and so on. These kinds of situations imply connection losses, API errors, and retries. These errors and retries translate into delayed petitions and higher loading times.

To overcome these challenges, Wave chose to integrate an in-app networking technology by PacketZoom, which specializes in accelerating content delivery by handling reconnects and creating a “Mobile Expresslane” between the app and the server. PacketZoom’s in-app technology is a content delivery network (CDN) enhancer and not a CDN replacement. By removing roadblocks in the mobile last mile, PacketZoom is able to accelerate performance, rescue sessions from TCP connection drops, and reduce CDN costs. Wave configured PacketZoom Expresslane to accelerate Amazon API calls. By doing so, Wave was able to download its own data 2.49 times faster.

Databases without the grunt work

Nowadays, we don’t spend any time on database administration. RDS manages our automated backups. We monitor the instances by using AWS CloudWatch in case anything goes wrong. This way, we focus on creating our application and not on the infrastructure. We make sure that as developers, we have as much knowledge of database administration as possible. But we also work with Claranet (an AWS Premier Consulting Partner) as our DevOps provider.

We’d advise new RDS users to always use Multi-AZ instances in production with automated backups. They’re a lifesaver if things go wrong. Additionally, we can’t wait for the PostgreSQL-compatible version of Amazon Aurora to come out of preview so we can use it for our production databases. We recommend starting with RDS for PostgreSQL today and trying out the Aurora PostgreSQL version when available.