Running a site with 5000 visitors per day

If you had built a Meteor app and knew that you’d be getting about 5000 visitors per day, how would you handle deployment? Is mup enough? Is the meteorhacks:cluster package needed? Can I run the app on a single 2-core 4GB VPS, or do I need multiple servers? Should I use nginx and proxy_pass back to port 3000, or not use nginx at all?

Or should I be using Phusion Passenger instead of mup?

I’m curious what’s been proven and tested.

Are you asking about handling peak load of 5,000 concurrent users?
Otherwise 5,000 in a day could just be 500 unique per hour over 10 hours.

Pretty sure that I read that Dominus the game has a couple hundred concurrent and it is running on a $10 a month D/O droplet.

It probably also depends on how much data is being subscribed to because thats what the app needs to manage for each of the users. I think the Observer reuse would also play a big part in that.

Nope, just 5000 users spread out over the day. So nothing too serious.

I understand how to make the code optimized, but my question is more from a devops perspective. Server set-up and config.

I would just use a standard MUP config and deploy it to a Digital Ocean 2GB instance with a Compose elastic SSD replica set for the DB.

If you need to have elastic scaling, Modulus is the most simple way to get elastic load balancing. However this would likely be a bit more per month (possibly less since you don’t have the overhead and with much less headache).

I’ve used both and had great service. One app I have on Modulus took around 3k users within a two hour period with no issues. The most it used was around 3 instances. Though this was highly optimized for mobile so other apps may differ of course.

I haven’t used cluster yet but have wanted to. If you’re not using cluster and need to load balance, Nginx or HAProxy can be used with MUP.

Okay, so I can get started on a single VPS for now. I assume if I monitor the server and see I’m running out of RAM or CPU is spiking, that means it’s time to spin up another server and do some load balancing? (or how would I tell if the server can’t handle the traffic it’s getting) And then both servers would access a single MongoDB server? (hopefully I wouldn’t have to get into sharding)

I’m just a developer, not a devops guy. :slight_smile: So this is a little beyond me.

I can use cluster, but I’m wondering if I put nginx in front of the Meteor app (and use proxy_pass), if cluster still works properly and spawns instances that communicate with each other. I’m assuming it does.

Are there any good web stress testing tools you would recommend? Something that doesn’t just hit a URL, but maybe can simulate POSTing data, or randomly visiting links? And simulate a dozen concurrent users?

Hi, man! Do not panic. We have been use 1GB DO until a 1000 visiters per day. Uploaded files has been stored there too (with caching on cloudflare) and with mongo DB running ot te same (!) instance. Meteor/node works fine and seems better than php or ruby. So try to ue Compose and let more CPU and RAM on the main instance. You could use kadira to optimize your app first and then try to scale it horizontaly

I feel you! I’m not incredibly experienced with devops but tinker with it as more of a hobby.

If it’s not going to break the bank, I would highly recommend going the modulus route, even if it’s for a short time. It eliminates the devops part, all you have to do is modulus deploy and drag the slider to 2 instances and you have a load balanced cluster!

We did this for Blonk’s mobile and desktop apps and it’s trivial to spin up 5 instances that are load balanced. You can also set an auto scaling if your peak CPU goes over a certain %. This way you scale down during non peak hours and scale back up when demand hits. This let us focus on building the app and not keeping it going.

Yea, if you’re using Digital Ocean you’ll have to SSH into the linux boxes and monitor their stats on the command line. Once the box gets loaded down the requests will take longer than normal to fulfill. You can use something like Pingdom to monitor the ping response time to get a rough idea of load.

You can also use Kadira to send alerts when your resources rise above a set threshold. Then you can manually raise the CPU/RAM and then reboot to get the increased resources.

You won’t likely top out of ram, more likely CPU. NodeJS also won’t take advantage of extra cores so going to a multi core box won’t help much. This is where having multiple single core boxes will help.

I would also not host your own database if security and data integrity are important. It’s non trivial to do it right. Compose can host a free database to start and let you upgrade to an SSD replica set cluster when you need it. Modulus also offers a database but I would l use Compose with their awesome web utilities.

You can setup the database on a separate server (or use Compose) and then access it with the mongo URL. All app instances will connect to the same db.

I’ve been meaning to do a screencast on this but you can use several online services to blast your website with a ton of users to see either A. how much one box takes before it’s unusable, or B. how it performs as it’s auto-scaling from 1 to 2 to 3 to 4 instances. You can either run a jQuery based script on startup that will click, pause, and go through steps, or some of these services include browser extensions to record users actions that all the ‘bots’ will do. something like this. However i’ve only used which works well. Just don’t run this in production (or free severs) :smile:

The nice thing is you can use this with something like Kadira to find bottlenecks in your app and then fix, and re-run to measure the performance increase.

Hope this helps!