Karma has big plans to help reduce food waste and is scaling with Google Cloud

Profile picture for user ddpreez By Derek du Preez April 20, 2021
Summary:
Karma is connecting consumers with retailers that have surplus food - and Google Cloud is helping it to adapt its business model and to scale.

Image of apples in a bag
(Image by Jasmin Sessler from Pixabay )

Food waste is a huge problem. According to the UN, we wasted 931 million tonnes of food in 2019, which is 17% of all food available to consumers. Swedish start-up Karma thinks it can be part of the solution and its app is now available in 225 towns and cities across Sweden, the UK and France - being used by 1.4 million people. 

But what does Karma do, exactly? The company actually started as a deal platform - think along the lines of a crowdsourcing Groupon - but ended up with a product that didn't really work. Speaking with co-founder and CPO Elsa Bernadotte, she says that "we started Karma by failing in nine months". 

However, when the company began to look into the data, it found that there were actually quite a few food deals out there from restaurants and realised that there was a massive problem for food retailers wanting to sell surplus food that otherwise would have gone to waste. That is now Karma's primary business model - connecting consumers and food retailers directly, selling surplus food at discounted prices, rather than it being thrown out. 

Karma has two applications - one for consumers and one for the retailers. The app for retailers is getting particularly interesting, as the company aims to make more use of its data and move towards predictive interventions, helping retailers understand what food items they should be ordering for which days - with the aim of helping to eliminate waste altogether. More on that later. 

However, as Karma has grown, so has its technology requirements. And as it began to expand internationally into new regions, it decided that it needed to shift its infrastructure to a new platform that could scale and ensure reliability. For that, Karma has chosen Google Cloud. 

We got the chance to speak with Koen Brörmann, Product Manager at Karma, about how the company is now thinking about its technology estate. As it began to grow, it decided that it would need to move away from its bare metal infrastructure, which was too manual and proving burdensome, and adopt a more DevOps approach to delivery. Brörmann explains: 

We faced a lot of challenges that most startups out there are facing. Mostly scaling issues. Firstly, every day we have more users than the day before, but also the behaviour that we see is incredibly peaky - so people want to eat throughout the same time and we have massive amounts of people jumping onto the app at the same time. So, although we had an acceptable amount of uptime, it wasn't at the point where we wanted it to be, and we knew it was only gonna go down from where we were.

Karma was working with Digital Ocean, but had a very manual setup that was proving to be very costly. For example, it had 20% of its engineering team working on the infrastructure, but also if anything needed releasing, it required a process that had to go through the infrastructure team. Brörmann adds: 

That really led us to start looking around - what's something that can help us scale and is reliable? But also what can help us deliver faster. And what was really important for us was, what is available for us outside of purely infrastructure? And that led us to Google Cloud because it has such a huge suite of different tools. 

Knowledge is key

Karma had already started working with microservices prior to moving over to Google Cloud, which it says made the migration a lot easier and fairly painless. It also meant that any future releases were easier to debug. 

Using Kubernetes, the open-source container-based technology developed at Google, Karma has been able to replicate and improve upon its old setup. With Google Kubernetes Engine (GKE) forming the core of the new infrastructure, the company says that it has greatly simplified much of its operations management, along with Google Cloud Pub/Sub for its messaging system. It has recently built on these efficiency gains by incorporating Google Cloud Functions and Google Cloud Run for even more automation

Brörmann explains that the migration began at the end of 2018, where it took about six months to move 80% of its systems over. It then took three to six months to move the remaining 20%

The main challenge with the migration to Google Cloud actually was down to Karma's knowledge management, as part of the earlier shift to microservices. Brörmann says: 

I would say that the challenges were mostly based on our decisions. There's a lot of benefits when going with microservices, but there were also some other things related to that decision around compartmentalised domain knowledge. 

This made it really hard to transfer that knowledge, because when we decided to move over completely, the person that was in charge of the architecture felt like it was so self driven and self maintained that they couldn't bring the value that they used to do. So he decided to move on from Karma, no bad feelings, obviously, but that left a huge gap in domain knowledge and it forced us to really start documenting better. 

And to get better with setups with redundancies for knowledge and having multiple people working on the same stack as well. That has been a benefit overall retrospectively, but at the time it was fairly intense with knowledge transfer.

Food for thought

In addition to the technical scaling requirements, Karma has also moved its databases into Google BigQuery, which is allowing it to expand its vision for how it is thinking about eliminating food waste through the use of data. It is essentially adapting its business model for how it works with retailers, using Google Cloud's machine learning capabilities to provide more predictive insights. Brörmann says: 

We have fairly big datasets. We've got 4 million meals saved already. What we basically do at the moment, which is live with BigQuery ML, is that we look at demand in certain areas, and we tell our partners that demand is going up the next day, or it is going to go down, or it is going to stay the same. And we show them what the probability is for those. This allows them to prepare in advance so that they can produce more or less tomorrow, and make decisions based on that. 

But really our long term goal is to make predictions about how much they need to produce of a certain item. For instance, if you make cinnamon buns - on an average day you'll make 20, but tomorrow you should make 22 because it's going to be good weather. Or you should make 10 less because it's going to be raining. That's what we're working towards. 

This is the long-term goal for Karma. Whilst the company is redistributing food waste at present, it wants to be more active in eliminating it. Brörmann says: 

I'm super happy that we're making a difference by redistributing surplus food, but I would feel 10 times better if we can help prevent that from happening in the first place. So that's something we're working really hard towards."