Scaling Parse Server

scaling_parse_server

It’s been a while since Parse closed down completely in Jan 2017. 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.

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.

 

parserequests

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.

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.

horizontal_scaling_parse

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.

mongodb

 

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.

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.

 

 


Leave a reply

Your email address will not be published.