Skip to content

Scaling Parse Server #244

Description

@gateway

So with all the new stuff coming out where the team at Parse is converting their GO version of the Parse server to Node.js I would like to hear from the Parse team on
the best way we can scale horizontally. I havent used Node.js in some time and I know their are some packages to help scale but I would like to get some professional advice
on how this would work, how to deploy code across the server, how to deal with cloud code etc.. is it set up to scale?

Here are some things I have found but not personally used.

The idea is to make sure that each serve can handle x amount of requests and you probably need to have a load balancer/s (for fail over) in front to check the health and send the request to each parse server.

Anyhow I'm curious if anyone has any thoughts on this?

Activity

  1. changed the title [-]Scaling Parse Sever[/-] [+]Scaling Parse Server[/+] on Feb 4, 2016
  2. duergner commented on Feb 4, 2016

    @duergner

    The easiest approach I found so far for scaling NodeJS instance is the following setup:

    Loadbalancer incl. SSL termination (HAProxy or ELB if on AWS) -- balance between multiple hosts --> NGinX (Gzip & Cache) -- balance between multiple NodeJS instances --> one NodeJS instance per CPU hard bound to a single CPU

  3. gateway commented on Feb 4, 2016

    @gateway
    Author

    @duergner thanks for the info.. the last stack I built was basically 2 haproxy's (one for fail over) a stack of node.js servers then couchbase as the database. One thing to consider with the node.js stack and a process running on each cpu core is the amount of requests that the actual server can handel, this is where you get deep into sysctrl settings which can be a big pain. I'm personally trying to avoid building this system again due to limited resources on my side but it would be good to hear peoples advice. I might try to set up a aws full stack this weekend and run some benchmarks with Jmeter/Apache Benchmark etc... Also another thing is making sure your database can scale.

    While not a walk though or full howto this was a decent article posted last about scaling.. http://highscalability.com/blog/2016/1/11/a-beginners-guide-to-scaling-to-11-million-users-on-amazons.html I just hope the parse-server can scale, and on top of that we should all be running profiling tools to see where performance bottle necks are.

  4. Copyrightsworld commented on Feb 5, 2016

    @Copyrightsworld

    Stupid question: Scaling PS via Heroku ?

  5. gateway commented on Feb 5, 2016

    @gateway
    Author
  6. flovilmart commented on Feb 5, 2016

    @flovilmart
    Contributor

    You can also use google app engine, as they support autoscaling node etc... It would end up being a containerized docker.

    I am wondering about the statelessness of the system, maybe some data would need to be shared across servers for optimization (memcached/redis) like a cache for active users and sessions etc..

  7. gateway commented on Feb 5, 2016

    @gateway
    Author

    @flovilmart I have tried them all, Heroku, GCloud, AWS.. I had such a headache with GCloud and some how spun up several servers etc.. I followed the docs but was a pain.. others might have different opinions.

  8. flovilmart commented on Feb 5, 2016

    @flovilmart
    Contributor

    @gateway, The doc is pretty bad indeed, but auto scaling is configured in the app.yaml. Would you want an example?

  9. gateway commented on Feb 5, 2016

    @gateway
    Author

    @flovilmart I'm leaning more towards aws system with maybe mongo db cloud interface to deploy mongo db's into aws that gives me visual overview of the database, backup and scaling..

    So Elastic Bean Stalk running some c4.large parse servers, then 2-3 mongodb managed by mongo cloud, with the newrelic plugin to monitor all servers, transaction traces.. etc

  10. gateway commented on Feb 6, 2016

    @gateway
    Author

    Anyone used cluster in node.js on aws servers? I'm looking at using some c4.large boxes with the elastic beanstalk system and they are specked with 2 vCPU's and since node.js runs on one thread ideally in this case it could launch and use both thread on this box. Any thoughts, feedback or suggestions on if this is a good approach and if show how would one set this up since I never messed with cluster

  11. OliverNicolini commented on Feb 6, 2016

    @OliverNicolini

    @gateway you can use pm2 with cluster mode

  12. gateway commented on Feb 7, 2016

    @gateway
    Author

    @OliverNicolini could you explain how I would do this, let's say I have 2 cores on a server how would I use this? Also I assuming I need to limit the amount of memory used in the server to make sure the OS can still run. What about if a node.js instance crashes ?

  13. OliverNicolini commented on Feb 7, 2016

    @OliverNicolini

    @gateway
    First install pm2: sudo npm install -g pm2
    Then make sure it will restart if the system reboot by typing: sudo pm2 startup
    Then start parse server like this: pm2 start pm2_parse.json
    with pm2_parse.json like the following:

    {
      "apps" : [
                      {
                            "name"            : "parse-server",
                            "cwd"               : "path/to/parse-server/",
                            "script"             : "index.js",
                            "log_date_format"  : "YYYY-MM-DD HH:mm Z",
                            "instances"        :  2, \\ number of cores,
                            "max_memory_restart":  "100M",
                            "exec_interpreter" : "node",
                            "exec_mode"        : "cluster",
                            "autorestart"          : true
                     }
                  ]
    }

    This will spawn 2 instances of your parse server restart them if they reach 100Mb of memory as well as restarting them if they crash.

  14. gateway commented on Feb 8, 2016

    @gateway
    Author

    @OliverNicolini thanks man! Ill test this out.. is their a rule of thumb on cpu cores and node.js instances? meaning if I have 4, should I do 3 node.js instances to keep one core for the OS?

  15. campers commented on Feb 11, 2016

    @campers

    I'm building a Java/Kotlin app using the Google cloud api's to provision a Mongo server with persistent disk and node.js servers in an auto-scaling group on Compute Engine.

    15% - 40% cheaper on Google cloud than AWS by their numbers, which makes it way cheaper than Heroku, even with a reasonable network egress allowance.

    http://googlecloudplatform.blogspot.com.au/2016/01/Happy-New-Year-from-Google-Cloud-Platform-still-the-price-performance-leader-in-public-cloudom-google-cloud.html

  16. kenglou commented on Feb 18, 2016

    @kenglou

    Is Google Cloud Accessible by China Market?

  17. campers commented on Feb 18, 2016

    @campers

    Not sure, this article says HTC uses the google cloud everywhere except China where it uses Azure http://www.businessinsider.com.au/htc-chooses-google-cloud-platform-over-amazon-alibaba-2015-6?r=US&IR=T

  18. kenglou commented on Feb 18, 2016

    @kenglou

    Ya, previously i use Google App Engine and found that it don't have accessibility in china, and that's the pain. I wish to know more about accessibility of those cloud/server provider around the world.

  19. Copyrightsworld commented on Mar 2, 2016

    @Copyrightsworld

    Ok, but will adding more web Dynos on my heroku sever actually scale my Parse server so it can servers more and more requests?

  20. carmenlau commented on Mar 10, 2016

    @carmenlau
    Contributor

    Would like to know about the statelessness of the parse server too. So that we can deploy multiple parse server instance. :)

  21. gfosco commented on Mar 17, 2016

    @gfosco
    Contributor

    Yeah that should work very well on heroku, the separate instances don't need to share state.

  22. hramos commented on Apr 2, 2016

    @hramos
    Contributor

    I am closing this out as we're trying to cut down on the number of non-issues. This will help us focus on the issues that are actively preventing people from migrating their production apps to Parse Server.

    As an alternative, I suggest opening a new discussion at Server Fault, a Q&A site dedicated to "questions about managing information technology systems in a business environment".

  23. gateway commented on Sep 8, 2016

    @gateway
    Author

    @hramos I do have to say nobody is really answering anything on Server Fault, its not been really helpful and while I know the parse crew is quite busy it would be nice to have some questions answered, esp when it comes to scaling or running on more than one core.

  24. flovilmart commented on Sep 8, 2016

    @flovilmart
    Contributor

    @gateway yes but this is also not an 'ISSUE' on parse-server, this applies to anything that is an express app backed by mongodb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions