Reputation: 81
Redis is single threaded yet it is fast. Can we use Redis database for API calls as APIs call is concurrent in nature? Is Redis capable of handling multiple API call requests?
Upvotes: 5
Views: 1804
Reputation: 3213
Yes, you can use.
Redis
is very very fast. You might want to take a look at their benchmark. Moreover, we can scale Redis
horizontally via clustering and partitioning.
Partitioning allows scaling the computational power to multiple cores and multiple computers, and the network bandwidth to multiple computers and network adapters.
https://redis.io/topics/partitioning
https://redis.io/topics/cluster-tutorial
Upvotes: 2
Reputation: 4173
Yes, you can use Redis at the database for a system that needs to support multiple concurrent API calls.
When you implement your API calls using whatever framework and language you are interested in using, if your API implementation needs to make a request to Redis, that call will wait on the accept queue for the socket until your request gets processed.
Many large websites use Redis as a database to implement APIs in the manner you suggest.
Upvotes: 7