Server slow (console view and custom business logic execution)

Last few days the server is really slow.
Sometimes I have to wait for 20 seconds or more just show me the table of Users that has only about 10 records filled in.
It didn’t bother me too much but today, while calling an API for saving some data I am getting back the following error:
“Sending failed: Custom business logic execution has been terminated because it did not complete in permitted time - 5 seconds”
Custom business logic is a small method that executes AFTER creation of a new record and changes one of its Boolean fields to True if one field containing email is similar to a set of whitelisted strings.
It used to run without any problems until now, so I know I didn’t change any code.
I am assuming that for some reason machine is so slow it can’t handle the execution of this function within the period of 5 seconds.
PS: Console is currently working better again, but the error remains.

UPDATE: And now… a few minuted after creating this post, it all runs smoothly again!

UPDATE: And now… a few minuted after creating the post above, it went through smoothly again!

What language is the business logic written in? How many queries (or API calls) does it make?

If the business logic script takes more than 5 seconds to run, it does not mater if it is executed before or after. If you run the business logic in the debug mode (that is locally), you can check how long it takes to run - please share your findings with us.

Regards,
Mark

The code is in Java and its running in production but I can try do it through debug.
Can you help me with setting it up so I could see the time passed? Do I need to do it manually in code or is there some place wehre I could see the execution time?

The only significant calls within code are:

String ownerId = result.getResult().getOwnerId();
BackendlessUser user = Backendless.Persistence.of( BackendlessUser.class ).findById( ownerId );

and

sendEmail("some@mail.com", "Backendless alert!....", mailBody);

The “sendEmail” call may take some time depending on how quickly the SMTP server processes the request. That would be the only factor here that could impact the duration of the script execution.

ok. If this is the only problem I can solve it in other ways.

Thank you!

No problem. I’d start by removing that call (if it is not essential for the business logic of your app) and see if the problem occurs again.

Yes. I’ll do that.

Thanks. I will mark the topic as “solved” for now.

I have same problem sometimes. It’s not about 20s but still it’s a bit too long. It’s occurs even on getting 1 user from db. In DB i have just 5 users.

“same problem” as what? A timeout from the server-side business logic?

Sorry i should clarified. Sometimes i need to wait few seconds (max 8) to get user from DB.
I’m using async android method. It’s looks like it’s waiting for server response becouse it’s different delay each time.

There could be multiple reasons for it. For example, if you have a lot of user properties or you have a lot of relations with auto-load enabled.

I have just 2 additional user properties and none of auto-loading. Sometimes even web panel is laggy. At first i thought it’s my internet connection. But i’m using my weak internet for PC and for my mobile i’m using LTE with best signal. I will ask my testers if they have same issues.

Please let us know if the problem persists for other users/testers.

Thanks,
Mark

Hi Mark,

I have the similar problem with our PetComm app:
https://itunes.apple.com/us/app/petcomm-connecting-community/id1140363069?ls=1&mt=8

Hello, could you check again?