Parse Server - AWS Self Hosting Costs

30
back4app.com How much cost Parse self-hosting?

Transcript of Parse Server - AWS Self Hosting Costs

Page 1: Parse Server - AWS Self Hosting Costs

back4app.comHow much cost Parse self-hosting?

Page 2: Parse Server - AWS Self Hosting Costs

How Much cost Parse self-hosting?

• In this presentation, we are comparing expenses required to host the complete Parse solution (Parse Server + Database) in two different configurations.

• The first configuration covers small apps and the second covers scaling / large apps.

• Small Apps – Will detail the structure required for starting apps with less than ten requests/second and minimum server-side processing.

• Large and Scaling Apps – Will detail the structure required for scaling and large apps with more than 10 API requests per second.

Page 3: Parse Server - AWS Self Hosting Costs

How Much cost Parse self-hosting?

• Building a new API and running it on production environment demands not only dedicated developers but also adequate infrastructure.

• Parse.com is a BaaS – Backend as a Service provider (Infrastructure + Backend) and hosts the infrastructure at Amazon Web Services cloud.

• The open source version of Parse.com (Parse Server) can be hosted on various types of infrastructure.

Page 4: Parse Server - AWS Self Hosting Costs

How Much cost Parse self-hosting?

• Parse Server is developed in NodeJS using the Express framework.

• Parse server uses MongoDB with the Mongo Rocks, a proprietary improvement developed by Parse Team to optimize compression and performance of MongoDB.

• You can read the original publication on: http://blog.back4app.com/2016/06/21/parse-aws/

Page 5: Parse Server - AWS Self Hosting Costs

Small Apps < 10 request / second

• The minimum recommended infrastructure to install a Parse app is based on two different servers.

• One server to run Parse Server + Parse Dashboard and another server to run the MongoDB (without Mongo Rocks).

• This presentation talks about the minimum infrastructure necessary to run Parse Open source solution.

Minimum Infrastructure

Page 6: Parse Server - AWS Self Hosting Costs

Small Apps < 10 request / second

• With minimum infrastructure, you can have the servers up and running, but quality parameters such as performance and availability (also factors such as backups, redundancy, and recovery) are not considered.

• The infrastructure recommended by Parse.com team is also included at the end of this article.

Minimum Infrastructure

Description Server Quantity Server Purpose

Parse Server 1Compute

Optimization

Mongo DB 1 I/O Optimization

Page 7: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• AWS is a secure cloud services platform providing a broad set of infrastructure products, ranging from bare metal instances to fully managed solutions.

• Parse.com is hosted on AWS North Virginia.

• Parse team recommends you to use AWS Elastic Beanstalk to host Parse Server applications.

• With AWS you can not only handle the deployment but also manage vertical scaling and monitor the usage of the applications developed with Node.JS.

Page 8: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• You retain full control over the AWS resources powering your application and access the underlying resources at any time.

• There is no additional charge for AWS Elastic Beanstalk and you pay only for the AWS resources needed to store and run your applications.

• You can launch the AWS Elastic Beanstalk deployment flow.

• There are different pricing for various EC2 instances.

Page 9: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• Amazon offers a free tier (t1.micro instances), but this instance does not support Parse Server.

• The default instance type will be a t2.small as this is the minimum instance type determined to run Parse Server, but this instance is more indicated for testing environments.

Page 10: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• A ‘c4.large’ instance is ideal for the production environment.

• You can quickly change the instance type by going to the ‘Configuration’ tab, clicking on the ‘Instances’ card, changing the instance type to ‘c4.large’, and clicking on ‘Apply’.

Page 11: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

Page 12: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• On-Demand Instances let you pay for computing capacity by the hour with no long-term commitments.

• This kind of service frees you from the costs and complexities of planning, purchasing, and maintaining hardware and transforms what are commonly large fixed costs into much smaller variable costs.

• For a c4.large, it may typically cost $0.105 per hour.

Page 13: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• Reserved Instances provide you with a significant discount (up to 75%) compared to On-Demand Instance pricing.

• You can purchase Standard Reserved Instances that are available on an ‘always-on’ (24 x 7) basis, or you can buy Scheduled Reserved Instances to use on a recurring scheduled basis.

• You can choose between three payment options when you purchase a Standard Reserved Instance – All Upfront, Partial Upfront, and No Upfront.

Page 14: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• The total cost for one month is the sum of the expense of the running instances, overall AWS data transfer, Elastic Load Balancers, and the data processed by the Elastic Load Balancers.

Amazon EC2 Instance Cost = Instance cost per hour X Number of instances X Uptime in hours

Instance cost per hour = $0.105

AWS Data Transfer Cost = (Data in (GB) X Data in Rate) + (Data out (GB) X Data out Rate)

Data out Rate (100GB) = $ 8.91

Total Parse Server monthly cost: $ 76.86

Page 15: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

• For the Parse Server database, you need a service that frees you from managing the underlying infrastructure for your MongoDB instances.

• At this minimum option, we are going to use one only MongoDB instance.

• On AWS we have several EC2 options to host MongoDB going from t1.Micro to c3.large.

• Additionally, we also have the i2 instances that are the Parse recommended servers to Mongo Rocks performance, but we also will talk about that on the next topic.

Page 16: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

1. t1.Micro and t1.Small(low memory) – are most used for development and testing environments, so I don’t recommend.

2. m3.Medium and m3.XLarge(general purpose) – Ideal to start your app database.

If you need to improve performance you can upgrade memory or high I/O.

We are going to use this option on our self-hosting Option.

Page 17: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

3. r3.Large and r3.8xLarge (high Memory)- These instances are the sweet spot for your MongoDB instances.

They have the right balance of memory and compute power.

They are good candidates to run your larger MongoDB server.

4. I2.xlarge – I2.8xLarge, HS1(high I/O) – These are the “Cadillacs” of the EC2 world and you can run your most demanding MongoDB servers on these instances.

These instances provide a high amount memory and fast local SSDs.

Page 18: Parse Server - AWS Self Hosting Costs

Deploying a Small Parse App on Amazon

AWS Infrastructure

5. c3.large-c38xlarge(high computing) – These instances provide the best CPU performance for the price point.

However MongoDB does not need a lot of CPU and we have rarely found these to be useful.

We prefer the high memory and high IO instances to run our MongoDBdatabases.

m3.Large Instance cost per hour = $0.133

Total MongoDB monthly cost: $ 95.13

Page 19: Parse Server - AWS Self Hosting Costs

Small App Total Server Cost(Parse Server + MongoDB)

• The total cost equals to the sum of one Parse Server c4.large instance plus the cost of the MongoDB m3.Medium instance.

• Parse Server c4.large + Data Transfer = USD 76.86

• MongoDB m3.medium = USD 97.36

• Data Transfer = USD 8.91

• Total Cost(AWS discount applied) = USD 181.87

• Please note this cost does not cover S3 backups neither a redundant server structure.

Page 20: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

• Parse.com suggests infrastructure based on replication of Parse Server and MongoDB.

• The replication consists of two Parse Servers instances and three MongoDBinstances implementing the replicaSet (if you want to build a scalable structure of MongoDB, you‘ll need to implement charging as well but that probably needs a new Post to explain more ).

Page 21: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

• Replication is the process of synchronizing data across multiple servers.

• Replication provides redundancy and increases data availability with multiple copies of data on different database servers.

• Replication protects a database from the loss of a single server.

• It also allows you to recover from hardware failure and service interruptions.

• With additional copies of the data, you can dedicate one to disaster recovery, reporting, or backup.

Page 22: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

• For Parse Server, the replication process is very simple and consists of two simple servers that mirror each other.

• They are typically the same and are synchronized to have the same data always.

• In case one of them fails, the other is still there to support the app’s requests.

Page 23: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

• MongoDB achieves replication by the use of replica set.

• A replica set is a group of MongoDB instances that host the same data set.

• In a replica one primary node receives all write operations and the other two instances which are secondary apply operations from the primary so that they have the same data set.

• Replica set can have only one primary node.

Page 24: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

Page 25: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

• These deployments provide two complete copies of the data set at all times in addition to the primary.

• These replica sets provide additional fault tolerance and high availability.

• If the primary is unavailable, the replica set elects a secondary to be primary and continues normal operation.

• The old primary rejoins the set when available.

Page 26: Parse Server - AWS Self Hosting Costs

Large scaling AppsThe recommended infrastructure

Description Server Quantity Server Purpose

Parse Server 1 Compute Optimization

MongoDB-Primary 1I/O Optimization – Read

and Write

MongoDB-Secondary 2 I/O Optimization – Read

Page 27: Parse Server - AWS Self Hosting Costs

Deploying Large Parse App on AWSRecommended infrastructure

• On Parse Server side we keep using c4.Large but now with 2 servers in order to provide mirroring between the application servers.

Amazon EC2 Instance Cost = Instance cost per hour X Number of instances X Uptime in hours

Instance cost per hour = $0.105 AWS Data Transfer Cost = (Data in (GB) X

Data in Rate) + (Data out (GB) X Data out Rate)

Data out Rate (1TB) = $ 183.24

Total Parse Server monthly cost: $ 336.96

Page 28: Parse Server - AWS Self Hosting Costs

Deploying Large Parse App on AWSRecommended infrastructure

• On the database side we use the MongoRocks required the infrastructure(suggested by Parse Team).

• Parse runs its MongoDB databases in replica sets that include one primary and two secondary databases.

• Parse uses Amazon Elastic Block Store (Amazon EBS) to create snapshots frequently for each MongoDB shard, which is then uploaded to an Amazon Simple Storage Service (Amazon S3) bucket. If necessary, Parse can bring up a new node in a matter of minutes using Amazon S3 and join it to a cluster.

Page 29: Parse Server - AWS Self Hosting Costs

Deploying Large Parse App on AWSRecommended infrastructure

• They also recommend the i2 instances to deploy the MongoDb and a S3 instance to store the backups.

• So we will have 3 i2 instances running the MongoRocksDB. The total cost is shown bellow:

i2.Large Instance cost per hour = $0.853

s3 Instance(1TB) = $0.0125/GB

Total MongoDB monthly cost: $ 1979.70

Page 30: Parse Server - AWS Self Hosting Costs

Large App Total Server Cost(Parse Server + MongoDB)

• The total cost equals to the sum of one Parse Server c4.large instance plus the cost of the MongoDB i2.Large instance plus S3 storage(1TB).

• Parse Server c4.large + Data Transfer = USD 336.96

• MongoDB i2.Large + S3 Storage = USD 1979.70

• Total Cost(AWS discount applied) = USD 2355.02

• Please note this cost cover S3 backups and a redundant server structure.