137 points by neural_ninja 5 months ago flag hide 16 comments
someuser123 5 months ago next
Great post! I've been looking into serverless architecture lately and this is a really interesting use case.
original_poster 5 months ago next
@someuser123 Thanks! I'm glad you found it interesting. Serverless can be a bit tricky at first, but once you get the hang of it, the benefits can be huge.
anotheruser567 5 months ago prev next
How did you handle storing and retrieving the image data? S3?
original_poster 5 months ago next
@anotheruser567 Yes, I used S3 to store the images and for the API gateway to trigger the Lambda function. It makes it really easy to handle the images and event triggers.
someotheruser901 5 months ago prev next
I've heard people mention issues with cold starts for Lambda functions. Did you notice any performance issues?
original_poster 5 months ago next
@someotheruser901 Yes, cold starts can be a problem for serverless architectures, but in my experience the impact was minimal. AWS has been improving on their cold start times. There are ways to optimize it but it wasn't an issue for this project.
newusername876 5 months ago prev next
Did you consider running TensorFlow on GPU instances instead? I thought Lambda only runs on CPUs.
original_poster 5 months ago next
@newusername876 Yes, you're right. Lambda functions run on CPU instances only, so GPU instances weren't an option for me. However, I think the benefits of serverless architecture outweigh the potential performance gains of using GPUs for this specific use case.
otherusername234 5 months ago prev next
What about handling errors and retries? Did you build that into your architecture?
original_poster 5 months ago next
@otherusername234 I did. I used AWS Lambda's built-in retry mechanisms for handling errors. It worked pretty well and made it easy to manage retries and error handling without much extra code or configuration.
randomusername567 5 months ago prev next
How did you handle authentication and authorization? Did you use AWS Cognito?
original_poster 5 months ago next
@randomusername567 I did consider using AWS Cognito, but I decided to go with a simpler approach for this project. The API is not publicly accessible, so I opted for API Key authentication. It's not as sophisticated, but it gets the job done for what I need.
anonymous 5 months ago prev next
How did you performance test this setup? Any specific tools or techniques you'd recommend?
original_poster 5 months ago next
@anonymous I used AWS Lambda's built-in performance testing mechanism as well as JMeter to performance test the API. I'd highly recommend JMeter, especially if you're looking to simulate large loads. It's a really powerful tool and easy to use.
otherperson 5 months ago prev next
What was your approach to monitoring and logging? Did you use AWS Lambda's built-in CloudWatch?
original_poster 5 months ago next
@otherperson Yes, I used AWS Lambda's built-in CloudWatch to monitor and log all events and errors. It was really helpful for debugging and making sure everything was working as expected.