Scaling Parse Server

Now in 2020, more than 4 years have passed since Facebook decided to release the open-source version of Parse. During this time many new features were released and the community of supporters is larger than ever. We take pride in the number of Parse.com users who have subsequently decided to put their trust in Back4App’s Parse Server Platform. We want to share with the community some of the lessons we’ve learned since this journey begun.

Scaling Parse has been an issue for several Parse users and we will unlock the secrets of how to scale Parse.

Parse Server was launched as an Open Source version of Parse.com but it has proved a valuable resource in many other ways. It provides an excellent NodeJS framework for building and scaling your App. The app scaling in question is of the major variety — at Back4App we’ve scaled some apps up to 10.000 Req/s (about 80.000 simultaneous users). All of this is possible while staying in total control of your backend and avoiding the kind of locks and limitations that come with Black Box solutions.

This experience proves how Parse Server can scale to much more than the 600 req/s that Parse.com announced on its pricing page (see below), far beyond the limits imposed by some other black box backends. A number of valuable features ensure that Parse Server is your best app scaling option. I want to emphasize some of the most important of these elements.

1-Scale without major re-engineering

Flexibility to add new modules: As soon as your app grows you need new features to keep users engaged, or even to improve acquisition, and sometimes a complete backend platform might not be available. Because Parse Server is an open source solution it allows you to install a bunch of npm(NodeJS) modules and integrate new APIs accessing more advanced features.

Vertical x Horizontal Scaling: Parse Server is designed to support trouble-free horizontal scaling, for example, to share a state between the instances. It allows you to simply create new identical Parse Server instances to share your app requests processing. This helps you to find the best balance between vertical scaling that just increases your machine configs, and horizontal scaling to optimize your performance and costs. For example, you could start with one instance of Parse Server on a single machine and scale vertically onto a Cloud Platform while constantly monitoring cost and performance. As soon as your app grows you can create a copy of these servers and add a load balancer to better distribute the requests.

On the database side, MongoDB also solves the scaling problem. It allows you to start with a single structure of Mongo DB, and as soon as your app scales you can add a replica set and then go to a sharded cluster if your app reach unicorn levels.

Run on your app in a fail proof infrastructure

Redundancies are important when you start scaling your app. The last thing you want is your server down with a large quantity of users. Make sure you use the following structure as soon as you start scaling your app.

Load Balancer

Auto-scaling for application servers (minimum of two)

Replica Set for database servers (two servers + an arbiter)

Optimize your query performance: You can use Parse Server custom app requests to get the best performance for each app type. If your app’s features use a lot of geo-points you can set these queries to be processed on the secondary machine of your MongoDB structure.

2-The Parse Server stack is solid

It may look like a challenge at first glance, but the combo Node.js + MongoDB’s scalability is actually quite impressive. Even with Javascript’s single threaded nature, Node can take advantage of multiple cores using the cluster module — this allows a developer to create a network of processes with shared ports. To scale-out across multiple machines the developer can use nginx to load balance received requests across multiple Parse Server instances. In addition, Node’s site authentication can be efficiently executed using the connect-auth library. This process avoids some of the common development mistakes and speed is another major advantage. MongoDB’s scalability is widely questioned, but it has many features that support easy scaling. For example, MongoDB Ops Manager allows the developer to deploy and scale sharded clusters across multiple data centers (using only one click). Furthermore, MongoDB Ops Manager is really useful to track and measure your performance as it triggers when metrics go out of range. If you take MongoDB + Node.js stack in its entirety it becomes clear that it covers all the metrics of scalability: cluster scale, performance scale and data scale. Leading companies like EA Sports, Square Enix and McAfee use the combo, and it is easy to understand why.

3-Deploy Parse Server anywhere

You can install Parse Server on servers of your choice. This allows you to avoid problems such as latency, and to use the best infrastructure to fit your needs. If you have the skills you can build your own infra optimized to your app and host Parse Server. You can also opt for a Cloud solution if you think it will perform better.

It’s possible to deploy Parse in any major cloud available in the market. Examples are AWS, Google Cloud, Digital Ocean or Azure. If you prefer managed and specialized service, you can go for Back4app.

We conclude that the open source model is the key to Parse Server’s success. This model really ensures that you can do wherever you want with the framework as soon as you scale your app. This goes a long way to explaining why Parse Server has become the most popular open source framework for building app backends. Currently, the git repository has more than 26000 stargazers, and the community includes more than 100.000k developers.

Did you like this post? Sign Up Back4App for FREE.

How to scale Parse Server? To achieve the highest performance levels with large Parse apps, please:

– Optimize your queries for performance;

– Runs your app in a fail-safe and redundant structure;

– Add NPM modules extensivly

How large can a Parse app be? At Back4app, we already scaled apps above the 10,000 requests per second mark. So, the apps can grow pretty big with the adequate infrastructure.