Conference Schedule - PGConf.EU 2019
Building iFood's content search platform with PostgreSQL
Time: 13:40 - 14:30
iFood is the leading online food delivery service in Latin America, with operations in Brazil, Mexico and Colombia, currently having more than 17 millions of orders monthly in the platform and growing around than 130% a year!
The tech stack consists of hundreds of micro-service, with hundreds of databases (most running on top of PostgreSQL). With such architecture, we had the challenge to build an API for our mobile apps and website capable of indexing the contents of those services/databases in a single place, with high scalability, a lot of filters and search capabilities and geo-located. And it should handle more than 10K TPS.
All services owning the information were already on PostgreSQL, enabling us to use PG 10 built-in logical replication to synchronize many instances into a single one, and build a different schema specifically designed for search. This instance is then replicated on many AWS EC2 instances using Auto Scalling Group and the application connects on them through a Network Load Balancing, enabling us to achieve fast writes on the indexation (after changed data is available after a few milliseconds to end users) and elasticity (running more servers on peak hours). Enabling us to achieve and overcome our 10K TPS.
Besides from logical replication, this system uses a lot of loved features from PostgreSQL, like: full text search + pg_trgm to build search box (and the ugly parts of it), PostGIS for geo-location, range types for shift hours, and many others.
On this presentation I'm going to show this architecture, the good and bad things we've found while building it and after running in production.