In 2006, Redfin was the first company to put homes on a map⁰. This was even before Google Maps was a performant platform. They launched with Microsoft Virtual Earth before migrating to Google Maps in 2008¹. This was a legendary achievement in proptech, massively empowering homebuyers to shop on their own. Ever since, high quality map browsing has been table stakes for any real estate shopping tool.
Going into Q2, the maps on Opendoor were having performance issues. When a user viewed homes in Phoenix, it could take 15+ seconds before they see anything on the map.
Before we could start optimizing map speed, we needed to figure out why it felt slow. After some profiling with Chrome dev tools, it became apparent that there was a slow call to our REST API to fetch the property listing data to display on the map. Looking further, Datadog showed us that the bulk of this time was spent in ActiveModelSerializers and fetching from the DB. We then constructed a metric that captured the user pain we wanted to address: p90 time to fetch property data for the map. We use a 90th percentile to capture the predominant user experience while excluding outliers.
We use Rails active_model_serializers to describe the fields that the REST API will return. A common problem in Rails apps is the same serializer being used for multiple endpoints and bloating to contain fields needed for multiple use-cases. This causes over-fetching of data both from our APIs and from the backing DB (we store listings in MongoDB). We also updated our Mongoid queries to use projections to return only the data necessary to fulfill the request from MongoDB. Creating specialized serializers just for the map component and reducing data fetches solved these issues and got us nearly a 2x speedup.