Obyvante
Obyvante

Reputation: 105

Using Redis for multiple platforms

I've been using Redis for a while for my project's stats. I'm using Jedis, Redis for java, currently for the project but I also would like to use same Redis server in multiple platforms like websites, android or even IOS. The project often uses Redis for gets and sets.

My questions

  1. There is only one Redis server now, so if I want to use in multiple platforms, it has to connect dedicated server which has latency between current server and Redis server. What should I do for that?
  2. I'd like to use only one Redis server for all of the connections. Is it dangerous or may it affect to performance?

If you have any idea related the topic, I'd like to hear your idea!

Upvotes: 0

Views: 332

Answers (1)

Ersoy
Ersoy

Reputation: 9624

First of all; for "better" and horizontal scaling your application server should not store any data. If your application server has MySQL database or Redis in there, then it would be difficult to scale since they are not "stateless". If you want to add second server to this design, then you can't duplicate your application server with your data. To make it "stateless" you have to move your data stores out of the application servers.

  1. You can't do anything about it. Latency is inevitable. What you may do is reducing it. If your Redis and application server is in the same region then it won't be a huge problem. If your application doesn't require internet access then you can put them in the same VPC.
  2. It depends. If your "Application A" is writing large objects every second, then "Application B" will suffer while reading, since Redis is single threaded. If both of your applications are making only fast requests (ex: get/set on small sized objects) then it won't be a huge deal.

You may check replication to provide higher availability if you have some concerns about it.

Replication can be used both for scalability, in order to have multiple replicas for read-only queries (for example, slow O(N) operations can be offloaded to replicas), or simply for improving data safety and high availability.

Upvotes: 1

Related Questions