Backend Workflow Keeps timing out because it's to busy

I only have like 300 users in my database, but when I run a workflow which does a search for users, to send to a backend workflow it goes really really slow. I see the bar at the top and it takes about 2 minutes to complete, and then I always get an error saying it’s to busy.

I’m not sure how else I should set this up so it is not slow, and this is very concerning about setting up the app on Bubble if it has a hard time with this with only 300 users. If I had 1,000, or 10,000, or a 100,000 user what would happen then?

Attached is an image of one example, but I have several similar to this where they all run really slow and often give a to busy after the progress bar finishes.

I’ve tried with an interval of 5 seconds and without, and it does not seem to change the behaivior.

I’m looking at the Periods where the app hits it’s max capacity %, and it looks flat, so I don’t feel like that’s the issue, and if so why is it so intense for 300 users on a relatively simple task???

Hi! :wave:

This is happening because you are running this workflow in user site (in the browser)…
Did you already tried to put it as a Backend workflow?

Yes, so move the “schedule on a list” into the backend too.

So the front end should just kick off the single workflow.

However I would be asking about why you need to do a workflow like this … why do you need to run a backend workflow on every single user … just to do a search?

Thank you for your help. I’m confused though since I thought that is what I’m doing is sending this to the backend workflow. How would I kickoff a single workflow?

@NigelG in this example it’s to send out a newsletter. How else would I be able to send this to everyone? The other is for events when I hit the publish button it sends out a notification to all users there is a new event.

@rpetribu & @NigelG, to give you more context I was told to send things to a backend workflow you need to setup the workflow on the backend, and then run an API on a list to send it. Was this incorrect?

Here is what the backend workflow looks like.

You are correct.

But the problem is that you are loading all your users in the front end just to check if they have submited to your newsletter or not. You can do this action in back end as well.

Create another backend workflow and call it “newsletter_list”;

In this workflow you will have only one action “Schedule API Workflow on a list”. Create the list just as you are doing…

Now, in the front end, you just need to trigger the backend workflow “newsletter_list” and the server will do the job for you…

Make sense?

Hello @rpetribu, yes I think that was pretty straight forward. I’m going to have to rethink how I’m doing a lot of my actions then.

So generally if I’m sending parameters on the front end that’s OK, but I want to try and avoid doing any searches?

Another one which takes a long time is when I publish an event. I have different situations depending on the type of an event and if it’s private or not private.

Would I create backend workflows like “Private Event”, Public Event" and in those they do the searches and then send it to the “notification-event” which has the notification workflow? Again with the goal of avoiding doing database searches on the front end?

Here is one of the event ones I currently have.

For example: Since this one does not do a search, would it be best to leave this one as is, or should I also create a list backend workflow?

Hi @eric10 !!

Yes, you are right. In general, it is not healthy to process a lot of data in user’s browser. So, if you can, it is ALWAYS better to send the workflow to the back end. In the case above, you can just leave it this way, there is no problem as the action is “quick” and will not slow your user experience.