Application Integration

AMPLIFY Mobile Backend Services and the cURL Firehose

I was testing AMPLIFY Mobile Backend Services and pumped gigabytes of data into it using cURL. Here are some observations – and how you can do this yourself!

You might have seen my interest in key/value stores, so when looking more closely at AMPLIFY Mobile Backend Services, I was intrigued to discover a key/value service that’s available via APIs. And, I was keen to try it out!

Now, I’m not much of a mobile app developer and understand that the service usually caters for folks working with various SDKs to consume managed backends that offer push notifications, location, check-ins, and many other things. But, since our MBaaS has an API (SwaggerDocumentation), nobody says you can’t use it from a script or even a backend of your choice.

So I’ve done exactly that – and wrote a couple of shell scripts that use cURL for Key/Value data manipulation. Find them on GitHub.

Shell scripts that use cURL for Key/Value data manipulation

Create a mobile backend service data sourceCreating a mobile backend service data source is very easy in the AMPLIFY Platform. Simply click on the ‘+’ sign and enter the details there. The only thing you’ll need to run the scripts is the App Key, which you’ll find in the Configuration section of your mobile backend. The scripts generate a user and manage the session (authentication is implemented with cookies), and from there we can do a very simple GET request to access keys. To set keys to a specific value, we need to supply the session cookie and the key + value as multipart/form-data.

Get the value of ‘foo’

GET /v1/keyvalues/get.json?name=foo&key=XXXX

Set ‘foo’ = ‘bar’

PUT /v1/keyvalues/set.json?key=XXXX
Cookie: _session_id=XXXXX
Content-Type: multipart/form-data; .........

Testing under load

So, this works quite well! I can imagine using this key/value store from a regular, probably Python-based backend.

To test the performance, I’ve pumped quite a bit of arbitrary data into one of the MBaaS buckets.

100 parallel workers, 10k requests in total with a ~20kb payload gives me response times around/under 1 second, this is quite good! I’ve brought this up to ~1 million requests and it’s still performing solid.

Use Cases

As I’ve already mentioned, the service is primarily intended as a mobile backend to be consumed by apps. However, the example shows that we can think of other use cases as well. My colleague, Shawn Ryan, puts it this way:

Front-end experiences may require a custom data store that needs to be quickly spun up and scalable, further, front end experiences can drive hundreds of millions of API calls per day to existing back end databases and these need protection from the load. Data as a service as a layer in between systems is then often used as a buffer between an enterprise back-end systems and the front end. Data as a service provides scale to a legacy back end at a lower cost (via noSQL linear scale) and further can serve to reduce complexity and ensure availability for any front-end experience.

Learn more about AMPLIFY Mobile Backend Services