You work for a company that automatically tags photographs using artificial neural networks (ANNs), which run on GPUs using C++
You receive many images at a time, but only 3 times per day on average.
These images are loaded into an AWS S3 bucket you control in a batch, and then the customer publishes a JSON-formatted manifest into another S3 bucket you control as well.
Each image takes 10 milliseconds to process using a full GPU.
Your neural network software requires 5 minutes to bootstrap.
Which of these is the best system architecture for this system?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - B.
The best way to get notified when the images get sent to the bucket is the S3 Events.
Here you don't need to provision infrastructure beforehand.
Since the source of S3 provides Event Handling, this should be used.
The AWS Documentation mentions the following on AWS S3 and Lambda.
Amazon S3 can publish events (for example, when an object is created in a bucket) to AWS Lambda and invoke your Lambda function by passing the event data as a parameter.
This integration enables you to write Lambda functions that process Amazon S3 events.
In Amazon S3, you add a bucket notification configuration that identifies the type of event that you want Amazon S3 to publish and the Lambda function that you want to invoke.
For more information on AWS Lambda and S3 Events, please visit the link:
http://docs.aws.amazon.com/lambda/latest/dg/with-s3.htmlThe best system architecture for this system is Option C. Here's why:
Option A:
This option involves creating an OpsWorks Stack with two Layers, one for launching and bootstrapping an HTTP API on G2 instances for image processing and another that monitors the S3 manifest bucket for new files. When a new file is detected, request instances to boot on the artificial neural network layer. Once the instances are up, submit processing requests to individual instances.
While this solution would work, it has some drawbacks. First, it requires the creation and management of an OpsWorks stack, which can be complex and time-consuming. Second, it doesn't take advantage of some of the serverless features of AWS, which could make the solution simpler and more cost-effective.
Option B:
This option involves creating an S3 notification configuration that publishes to AWS Lambda on the manifest bucket. The Lambda creates a CloudFormation Stack that contains the logic to construct an autoscaling worker tier of EC2 G2 instances with the artificial neural network code on each instance. An SQS queue of the images in the manifest is also created. When the queue is empty, the stack is torn down.
While this solution is scalable and cost-effective, it has some drawbacks. First, it requires the creation and management of a CloudFormation stack, which can be complex and time-consuming. Second, tearing down the stack when the queue is empty means that the system may not be able to process images immediately when they become available. Third, since the solution relies on EC2 instances, there is an ongoing cost for running the instances even when they are not being used.
Option C:
This option involves deploying the artificial neural network code to AWS Lambda as a bundled binary for the C++ extension. An S3 notification configuration is set up on the manifest bucket, which publishes to another AWS Lambda running controller code. This controller code publishes all the images in the manifest to AWS Kinesis. The ANN code Lambda Function uses the Kinesis as an Event Source. The system automatically scales when the stream contains image events.
This solution has several advantages. First, it is serverless, which means there are no ongoing costs for running instances when they are not being used. Second, the system automatically scales as needed, so it can handle spikes in demand. Third, it takes advantage of AWS Lambda's ability to scale horizontally, which means that many instances of the ANN code Lambda Function can run in parallel to process images quickly. Fourth, using Kinesis as an Event Source provides a scalable and reliable way to process large volumes of data. Fifth, deploying the ANN code to Lambda means that it can be updated quickly and easily.
Option D:
This option involves creating an Auto Scaling, Load Balanced Elastic Beanstalk worker tier Application and Environment. The artificial neural network code is deployed to G2 instances in this tier. The desired capacity is set to 1. The code periodically checks S3 for new manifests. When a new manifest is detected, all of the images in the manifest are pushed into the SQS queue associated with the Elastic Beanstalk worker tier.
While this solution is scalable and cost-effective, it has some drawbacks. First, it requires the creation and management of an Elastic Beanstalk environment, which can be complex and time-consuming. Second, since the solution relies on EC2 instances, there is an ongoing cost for running the instances even when they are not being used. Third, the desired capacity is set to 1, which means that the system may not be able to process images quickly if there is a spike in demand. Fourth, periodically checking S3 for new manifests means that the system may not be able to process images immediately when they become available.
In conclusion, Option C is the best system architecture for this system. It is serverless, scalable, reliable