My team has a FM Database, running on server 16, which utilizes a RESTFm / JSON API to support a web application. The API only passes 15 - 20 fields per record, and at the high side 1200-2000 records for a single request. This request takes some time to come back, on average 6-10 seconds, but more importantly when making requests to the API, concurrent requests fail.
Little more technical detail, we have a small service written in Node.js that manages the requests going to the API and uses it to create a read only cache in Redis, to speed up the above read requests to the API. We kept seeing where this Node service would start, then fail as it tried to make the initial requests to build the cache. When looking into it a bit more, it looks like the first request to the API returns with the expected data, but the other concurrent requests (sent asynchronously via an array of pre-formatted requests), all failed. I setup a small program to stress test the development version of this API, and found that so long as no request was sent concurrently, everything returned as expected. Once I started trying to send concurrent requests, they failed until the initial request returned. More importantly, it didn't matter if the request resulted in the above size dataset, or a single record (which when ran sequentially, return in sub 200ms).
I ran the above for a couple of hours and submitted 10k+ requests, and unfortunately the above conclusion was clear in the results.
My question is, is the ability to process concurrent requests via a RESTFm API or the JSON Web API introduced in FM16, inherent to these tools or is it dependent upon the scripting logic behind the API? If the latter, is it possible to write that scripting logic into the API(s), or is the underlying nature of FM strict about how API requests are handled?
Cards on the table, I am not a FT FM developer, but have been working with it in some capacity for the last two years. This database was updated from its original version only a few years ago, so I wouldn't really call it legacy or stale by any means, and handling concurrent requests seems to be pretty straightforward in most API technologies today. We have also ran into a couple of other issues when utilizing REST apis with FM, such as the native PHP Limit for data moving through the api endpoints.
Any insights or recommendations are welcome, and I am more than happy to share the results of the tests I ran above if needed. Thanks in advance!