I am exploring using AWS Lambda through Laravel Vapor. Avoiding the use of Redis can save us ~$56/mo (t2.small at ~$24, NAT Gateway at ~$32).
Instead of Redis, I plan to use DynamoDB which is much cheaper. Pretty much same thoughts to this thread https://twitter.com/JackEllis/status/1246500143425146880
My question is, does it make sense to use DynamoDB as a cache layer on top of RDS or is the latency pretty much the same, which means I would be better off just relying on MySQL's internal caching?
For context, in Laravel there's a package called laravel-model-caching that caches query results. With Redis as the cache driver it makes sense, because you get super low latency compared to mysql even with mysql caching.
But now if I get rid of Redis, caching queries using the package might not make sense if the cache layer is another DB (Dynamo) anyway.
Is my thinking correct that DynamoDB and RDS latency is not much different?
Couple of notes...
DynamoDB boasts a consistent millisecond latency, I doubt MySQL can achieve that. Both depend on the instance network performance of course, e.g.
t2.something
network is slower thanc5n.something
.Do you have only one Laravel node or more? If you have just one install Redis locally, no need for an extra EC2 instance.
Redis ElastiCache doesn’t need NAT
DynamoDB isn’t as cheap as it looks. The per query price may be small but using it as a cache may turn out to be quite expensive if you hammer it with lots of queries.
Hope that helps :)