Is it a good idea to have multiple server with load balancing?

I’m using Parse Server to support a mobile app and a website. I have three instances of the same parse server running in kubernetes with a load balancer. The reason for three instances is for redundancy and it has been working OK for me. I have only 10 requests/second.

I’m recently starting to thinking about improving the latency and reducing cloud hosting bill. I feel the three instances might be a waste of resource and also break caching. Want to get more understanding of the following aspects.

  1. Does the default cache mechanism work for multiple instance of parse server? Is it possible that after a write happens on server-1, a read on server-2 returns the previous (not outdated) value?

  2. What’s a good way for availability redundancy for parse server?

Thanks !

I believe 1cpu and 2gb ram machine can handle that requests easily. But your requests are also important. Ä°f your request is a cloud code that takes too much time then this values can change.

They should work. For only 10 req/sec, default cache manager can handle. You said you want to reduce servers. if you will still run more than 1 parse server instances, redis cache would be good way.

Once the write operation complete in server-1, all servers should return same updated value. But during write operation, server-2 may return old data(But its technically not old. Because object is not updated yet.)

I’m not an expert. So dont take my word on this. But I’m also developing an app. I will use PM2 module for running parse server. With this way, I can run multiple parse servers inside same machine. And module automatically load balance them. Module also monitors parse servers. and if error happens or somehow parse server crashed, ıt automatically restart parse server. And parse server is always up.

And If I need more computing power, I would run parse server in different machines. And I would load balance them with Nginx by setting up a reverse proxy.

Hi @willli666,

If you want to optimize the response time, first of all check you mongo indexes, and add indexes based on your recurrent queries.

About the cache, if you want to optimize multi parse server instance, you should use the Redis Cache Adapter and connect you parser servers to the same Redis data base.

Finally in your front app, try to add some select keys on your queries to only pull from the server (and the database) wanted fields. You can also use the new GraphQL API designed to optimize response size and reduce number of requests sent from the front app (GraphQL was specialy designed by facebook for this purpose).

I hope it helps :slight_smile:

For HA deployment, the traditional recommendation is a 3 point deployment, in your case with Kub, for a real HA, you should have 3 deployments on 3 differents Kub Nodes. If you self host you mongo, you should also use the mongo headless service (with replset key in uri).

Thanks for the suggestions.

Yes, I’m have 3 pods on 3 nodes and use a replica set from Atlas. I’m not sure what I did wrong but my pod would fail (restarted by itself) from time to time so less than 3 nodes would result in downtimes for me.

I will try the Redis Cache Adapter and also the GraphQL API . GCP has a product named Memorystore for Redis. Does this work for me?