Optimizing and scaling Strapi

Found the problem:

when I call const cam = await strapi.services.cameras.findOne({ mac })
is when the trouble begins. Turns out that the cam had accumulated ~3500 notifications which come in a form of a relation. So whenever I asked for this system’s data, I also got the data of 3500 notifications.

That is why it was so slow. But this makes me think:

Even if I had 3500 notifications associated with the system, would I still experience slower speeds if I would specify the fields I need using the populate argument? (Will report back here, when done experimenting)

 strapi.query('restaurant').find(params, populate);

I’ve noticed that using await can be quite blocking, maybe there is a way to use a callback function instead of await. Would it really matter though and make requests faster to proccess?

1 Like