Reputation:
I've faced the problem with DBs (specifically with MongoDB).
At first, I thought to deploy it to MongoDB Atlas Cloud
but the production Clusters (M30
and higher) are quite expensive for a little project like mine.
Now I am thinking about deploying the MongoDB
replica set somewhere on Heroku Dyno or maybe AWS instance.
Couldn't you please suggest any production-ready way/solution that would not cost much?
As I can see AWS offers some FREE Tiers for DBs (Amazon RDS
, Amazon DynamoDB
, and others) but is it really free or it's a trap? Because I heard AWS
Pricing policy is not that honey-sweet as it looks on the pricing page (in reality)
Any advice or help is welcomed!
Upvotes: 0
Views: 835
Reputation: 7578
Your least expensive way to experiment with MongoDB that still offers a path to scaling to something much larger is to get a free tier EC2 instance like a t2.micro
and install MongoDB Community on it yourself. The Linux 64bit distribution is available here: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-5.0.5.tgz. Simply run tar xf
on that tarfile and the mongod
server and mongo
CLI executables will be extracted. No other config required and pretty much you would start it like this:
$ mkdir -p /path/to/dbfiles
$ mongod --dbpath /path/to/dbfiles --logpath /path/to/dbfiles/mongo.log --replSet "rs0" --fork
You do not need a replica set to use aggregation, transactions, etc.
This solution will also expose you to a lot of important things like network security, database security, log management, driver compatibility, key vaults, and using the AWS Console and perhaps the AWS CLI to manipulate the environment. You can graduate to a bigger machine and create and add members to a replica set later -- or you can take the plunge and go with MongoDB Atlas. But at that point you'll be comfortable with functions esp. the aggregation pipeline, the document model, drivers, etc., all learned on essentially a zero-cost platform.
Performance is not really an issue here but using the handy load generator POCDriver (https://github.com/johnlpage/POCDriver) on a t2.micro
instance with no special setup and a doc size of 0.28Kb, with 90/10 read/insert mix on a default of 4 threads and batch update removed (-b 1), we get about 450 inserts/sec and 4200 reads/sec on primary key _id
.
java -jar POCDriver.jar --host "mongodb://localhost:27017" -k 90 -i 10 -b 1
Of course, the load generator is competing with the DB engine itself for resources but as a first cut it is good to know the performance independent of network considerations.
From launching the EC2 instance to running the test including installing java sudo yum -y install java-1.8.0-openjdk-devel.x86_64
took about 5 mins.
Upvotes: 1