REST API Load Balancing Within Mendix

0
Good day, We have a production application that uses APIs extensively. The issue we are facing is that we get a lot of concurrent transactions from the client-side for a specific resource. For example POST Member/Product/123456 (can potentially) be hit multiple times. Although we have validations in place, with concurrent transactions, however, the validations are rendered useless. Due to the amount of expected traffic, as well as the completion time requirements, we can not turn off concurrent microflow execution in the modeller. How can we effectively mitigate this issue? Thanks in advance!
asked
2 answers
0

Without changing any logic, you can add a uniqueness validation rule to the identifier and this will prevent duplicates with the downside of getting errors: uniqueness is checked in the database.

 

Alternatively, you can rethink the way you set up this API. Typically, when an external system POSTs information, you decide the identifier which this new object receives. Therefore, it doesn't make much sense to POST to /resources/identifer: you would typically POST to /resources. The object that is being posted may have an identifier which is known in the external system, but that should be present in the content and stored separately. You can now hand out identifiers in a way you see fit, using UUID's (see CommunityCommons GetRandomHash), using the objects internal ID (see CommunityCommons GetGUID) or any other way to generate an identifier. Even in this scenario, it may be worthwhile to use a validation rule.

answered
0

Does it help for you to use a local database to handle the user data? This makes your app faster with a better user experience.

To exchange from your local database with the API’s you can use scheduled events. This avoids concurrent call’s to the same endpoint.

 

answered