Help adding task queues as app is scalling

We are growing the activity in our app and are sometimes coming across the following error:

Maximum request per minute limit has been reached for the app. Please have the owner of the app contact Backendless to increase the rate limit.

The average load of our app is still quite low.

However, we have one method that is creating peaks.

This method peaks every 30 minutes because we are scheduling notifications to an external app. The way we are currently scheduling the notifications is via webhook and the previous notification generates the next one.

Is there a best practice in Backendless to gradually queue notifications on future dates instead of peaking every 30 minutes? Is there a blueprint app that uses notifications?

Hi, @Andreas_Marinopoulos

Try splitting one notification into several. To keep the number of API queries for the notification block within limits.
If your application will expand, I can offer you to switch to our PRO installation. You can know more about that in our sales department at sales@backendless.com.

P.S. The API call limit can be increased in individual cases, you can also find out more about this by writing to the email I gave you above.

Regards,
Marina

Thanks @Marina.Kan ! I am not completely sure what to do here.

Do you mean that I should reduce the number of payloads hitting our API enpdoiint?
image

What is the part of the process that counts as an API call and counts towards the 3000 per minute limit?

Is there some way to create a queue of tasks that will then be dealt with smoothly via a timer?

@Andreas_Marinopoulos

Do you mean that I should reduce the number of payloads hitting our API enpdoiint?

My suggestion was to send out not all users at once, but only a part of them. The second notification would send the next one and so on.

What is the part of the process that counts as an API call and counts towards the 3000 per minute limit?

A list of what counts as a call and what exactly exceeds the limit can be seen in the Manage → Analytics → API Calls section.

Is there some way to create a queue of tasks that will then be dealt with smoothly via a timer?

You need to implement such a timer in your application. So that, for example, every few minutes a certain number of users are sent notifications (within the limit of 3000 API calls).

Regards,
Marina

My problem is as follows:

The notifications are reminders for a lesson. We have 200 lessons that are happening at 10:00 UTC and they need to receive the reminder 30 minutes earlier. So we have 200 notifications that must leave at 9:30 UTC.

I have an external tool that can schedule the messages. But what is the best way to schedule them all for 9:30 UTC but only a few at a time?

Shall I use Cache?

Shall I use a temporary DB?

Is there a better way to manage queues?

Do the lessons always start on the hour and/or on the half an hour? If so, you could have a timer that wakes up every 30 minutes, does a query for all the lessons that will start in the next 30 minutes, and sends all the messages.

@mark-piller Yes it is every HH:00 and HH:30. And what you recommend is more or less what we are doing. Specifically, what we are doing is as follows:

  1. Each parent in our CRM has a scheduled notification on their contact object at all times. This allows us good Quality Control on the front end.
  2. When the scheduled notification is sent, a webhook from the CRM triggers a Backendless Method that schedules the following week’s notification.
  3. This creates peaks of activity every HH:00 and HH:30.

If we did not have eg. 200 webhooks arriving every HH:00 and HH:30, but instead have 1 timer schedule 200 messages at HH:00 and HH:30, would that not still breach the 3000 API call limit?

Is there not a better way to utilize queuing? Eg. a timer queries the CRM every HH:00 and HH:30 and receives the 200 contact objects in 1 API Call that no longer have a scheduled message on them, then uses the Bulk Create block to add the unique ids in a temporary Backendless DB on in cache. Another timer queries the temporary DB and schedules messages in the CRM, at the same time deleting the temporary DB entry. When the temporary DB is empty, the second timer is not scheduling anything. Is there a way to activate/disable a timer? As will only need it to run until the temporary DB is empty. Would such an approach work?

1 Like

The limit applies to the number of calls you make per minute. If you spread out the calls over a period of time, you will not be hitting the limit boundary.

Also, it is not clear to me why you need an additional call to schedule the following week’s notification. If the classes are in and you know when they start, the timer can continue to run and notify the users whenever their class is coming up.