1

I have a serverless app using AWS lambda. My lambda fetches some data from other third party APIs and I'm planning to implement backend caching to cache the data my lambda fetches. I've read some articles online and I saw some sample architectures.

enter image description here

If you observe the picture, the dynamoDB is used to store the cache of the data fetched by the lambda. People suggested DynamoDB as the latency it adds while fetching the cache is very minimal. But I cannot go to DynamoDB as each of my data item to be cached is very large, even after gzipping it (approx 5-7MB). Hence, Im planning to use a DocumentDB instead of a DynamoDB. Im just learning how DocumentDB works and have no idea if it is as fast and efficient as DynamoDB. Could anyone comment on this idea and give some suggestions regarding which options I could use in this case apart from DynamoDB and if DocumentDB is a good alternative?

Sai Krishna
  • 593
  • 1
  • 8
  • 25
  • `DocumentDB` is **not-serverless**. If its fine with you to have partial serverless architecture then you can use it. – Marcin Jan 25 '21 at 23:50
  • 1
    @Sai Krishna why can't we simply cache this 5-7 MB data in cloudFront, is there reason you need caching enabled only at Lambda ? – Balu Vyamajala Jan 26 '21 at 00:36
  • @Marcin, yes, Im fine with it being partially serverless. If thats the case, is using DocumentDB a good approach? – Sai Krishna Jan 26 '21 at 03:54
  • @BaluVyamajala, Yes, I am kind of implementing server side caching in a serverless architecture, and am looking at different ways to implement it at lambda – Sai Krishna Jan 26 '21 at 03:55

1 Answers1

1

If you need to cache 5-7MB worth of data, have you considered using S3 as a cache? S3 can be used as an effective (and cheap) nosql database. I'm not sure it will meet your specific use case, but it may be worth exploring depending on your needs.

I found a good conversation about this topic on StackOverflow if you want to dive deeper.

Seth Geoghegan
  • 5,372
  • 2
  • 8
  • 23