API or directly to AWS? - aws-sdk

I have a pretty straight forward question. If someone are to do a commercial Android project using AWS, is it best practice to build a RESTlet or Protocoll Buffers API (a server/service) for the app to communicate with which then send database requests to AWS, or do they skip the API and just communicate with the DynamoDB service directly which would be less code but not as cute?

I would say that decoupling your app from DynamoDB will help with scaling. What if you decide to not use DynamoDB anymore? You only have to change the service, and that can be transparent to the app and its users.
If your app can tolerate it, you could try an asynchronous approach. This will decrease latency and increase flexibility/scalability. An example of this: app pushes an event to an SNS topic. From there you can have SQS queues subscribed to this topic to retain these messages, and then have a Lambda function/web app that processes the queue.

Related

Google Compute API Anonymous Requests

Just noticed I have thousands of anonymous requests hitting all of the compute engine api list endpoints. I have no instances running and I'm only using Firebase and Cloud Build, Source, and Registry. Please see attached screenshot of API metrics report.
Any reason for this?
compute engine metrics
On the backend there are certain API calls needed to make sure that your project is healthy, these "Anonymous" requests represent an account used by the backend service making health checks.
Anonymous API calls (this could be just Compute Engine “list” calls) doesn't imply having enabled something from your side. A lot of different sections in the Console make calls to the Compute Engine API and there’s no easy way to figure out which section made the calls, but they are expected.
These kind of "Anonymous" Compute Engine APIs are part of the internal Monitoring tools needed to make sure that your project is healthy and are randomly triggered. These metrics might eventually disappear and come back throughout the project life.

IBM Maximo - Querying API for data with very slow response time

I have been looking everywhere for a solution to this problem.
At my work, we are trying to integrate Maximo with another system via the other systems REST API (which returns JSON responses). I am able to make this integration work on a small scale, however this API is taking upwards of 5 seconds to respond per request. Currently, I have defined this system as a JSON Resource, and I copy daily "snapshots" of the non-persistent data to a persistent attribute using an automation script. The requests all run in a sequence - which works slowly for 5 assets in testing, and will definitely not scale to 1000's of calls a day.
Assume that the API of the external system cannot be modified in any way... Is there a way to query this API in a non-blocking way? I'd imagine that if I could send a request, and send the next, etc. without needing to wait for a reply to proceed, this would solve the problem.
I looked into Invocation and Publishing Channels, and also Enterprise Services, and it seems like Enterprise Services along with JMS Queues might be what I need, however documentation says that these only support queuing incoming data... and I can't see how this solves my problem.
Any help? I am completely stuck on this.
Thank you!
I had to do something that sounds similar, once. I tried JSON Resources, but they didn't work for me. I ended up using the examples in Maximo 7.6 Scripting Features to do it. The first code sample in that document is a library script for making HTTP/S calls using out-of-the-Maximo-box libraries, and other examples in that document use IBM's JSONObject and JSONArray classes (also available out of the Maximo box) to parse responses.
To get things going concurrently / multithreaded, you could configure a cron task to call your automation script, and configure multiple instances on various schedules to call the same one and use the args or some other mechanism to prevent collisions.

Asynchronous Notification with REST

What is the best technique to push notifications from the cloud to a client? REST does not seem to support this. In particular, I have JSON objects representing world state going to the cloud and want to be able to notify a client when that state changes.
All HTML5 implementations I've seen support full duplex communication via WebSockets.
If you're using Google App Engine you can use the Channel API. https://developers.google.com/appengine/docs/java/channel/
If you're using JBoss you can use the Errai Framework. http://errai.github.io/
I'm sure there are a lot of other options out there. And there's always email.

Use of messaging like RabbitMQ in web application?

I would like to learn what are the scenarios/usecases/ where messaging like RabbitMQ can help consumer web applications.
Are there any specific resources to learn from?
What web applications currently are making use of such messaging schemes and how?
In general, a message bus (such as RabbitMQ, but not limited to) allows for a reliable queue of job processing.
What this means to you in terms of a web application is the ability to scale your app as demand grows and to keep your UI quick and responsive.
Instead of forcing the user to wait while a job is processed they can request a job to be processed (for example, clicking a button on a web page to begin transcoding a video file on your server) which sends a message to your bus, let's the backend service pick it up when it's turn in the queue comes up, and maybe notify the user that work has/will begin. You can then return control to the UI, so the user can continue working with the application.
In this situation, your web interface does zero heavy lifting, instead just giving the user visibility into stages of the process as you see fit (for example, the job could incrementally update database records with the state of process which you can query and display to your user).
I would assume that any web application that experiences any kind of considerable traffic would have this type of infrastructure. While there are downsides (network glitches could potentially disrupt message delivery, more complex infrastructure, etc.) the advantages of scaling your backend become increasingly evident. If you're using cloud services this type of infrastructure makes it trivial to add additional message handlers to process your jobs by subscribing to the job queue and just picking off messages to process.
I just did a Google search and came up with the following:
Reddit.com
Digg.com
Poppen.De
That should get you started, at least.

HTML5 Stress Testing

We have a webapp that's backed by a java spring web application. Apparently our Rational Robot tool that we normally would use to stress test a browser application doesn't deal with the HTML5'ness of our app. We are considering simply scripting the raw http requests to beat on the application, but wondering if anyone knows of any tools out there to do the same without having to craft all of the http requests by hand?
Apache JMeter allows you to record all http requests by setting it up as a proxy. You can then save those requests and play them back in multiple threads to simulate users.
Fiddler with our free stress testing add-on called StresStimulus is another proxy that records HTTP requests and replays them with configurable user ramping.
If you have anything a bit complex, it would be easier to record a script in one of the load testing tools. I have used WebLOAD in the past, which handles things like fetching all the sub-components, script correlation, AJAX recording, etc.
You can record straight from the Android device, or use a desktop browser you like.