Server for Meteor App

Hi,
I’m starting to develop with Meteor from few month, I’m using Meteor Up to deploy my app.
For production server is better many ram or many cpu power ?

That kind of depends on how data-heavy your app will be, how many concurrent users you expect to have, and how much processing is done server-side.

For many simple applications, I can quite easily cope with a single 1GB 1vCPU $5/mo droplet on Digital Ocean, with the DB installed on the same droplet, and it uses <5% CPU, and with about 150-250 concurrent users it uses about 66% of the RAM so there’s still plenty of room for growth.

The only way is to try it and see.

It seems a little bit to me.
I use react with the synchrony in real time of a dozen collections of about 3000 documents each and with 5 concurrent users in my vps with 2 cpu and 4 gb of ram, it looks pretty full.

Wow, maintaining subscriptions with 12x3000 documents really will hammer your server! Any document which has an active subscription has to be held in RAM by meteor. Fortunately if multiple users are subscribed to the same document then it’s only held in RAM once (I think), but still, that’s a lot.

Also, if your Mongo is not set up to use oplog (waching the update journal for changes) then instead it will be using polling (constantly re-fetching the data from Mongo and comparing with the data held in RAM) to find any changes to the subscribed data to send to the users. Fortunatley, with MUP, enabling the oplog is a single line in your mup.js, see my post about that here: Performance improvements with Oplog! (MUP deployment on single server)

However, even with oplog that is a LOT of data to be subscribed to. Is it necessary for all clients to be subscribed to all that data all the time? Have a look at pagination and see if that could be applied.

Also, only use subscriptions where you need reactivity on the clients. If you don’t need all that data to be reactive, then consider only subscribing to the data which needs to be reactive and using methods to fetch the non-reactive data as and when you need it.

Can we see your app?

Also, are you storing any of this data on the Meteor.user document? If so, check out my performance bug about that.

Unlike lots of FUD to the contrary, Meteor can scale well. Unfortunately, because Meteor makes subscribing to reactive data too easy, many developers over-use that feature which comes at a cost. If you use subscriptions carefully then it can scale.

3 Likes

Thanx for your answer, I have to refactor my project because, like you said, is to simple manage data with subscription and I think I made too many…
As soon as I have time I look at it and try to solve.

@wildhart can you give me another advice please ?
If I want to keep data in local minimongo for use in offline mode but not in real time (I don’t need to sync data automatically) the only way is using subscription client side ?

Now my data in client side is:

export default withTracker(() => {
	Meteor.subscribe("table1");
    return {
        Table1.find({}).fetch()
    }
}) (App)

and in server side:

Meteor.publish("table1", function table1Publication() {
    return Table1.find({});
}

I have a similar question. Since I am using Meteor on the front of my PHP based application for registration/booking. It is possible to run it on the PHP based stack? The PHP host I usually use for this supports all kinds of JS. It is just that the stack is a little custom as it include apache, nginx, php, and mysql.

1 Like

have you had the question answered? also searching for the answer if possible. also, it looks like you’re more experienced, may i ask you questions if i’m going to have some? thanks

Hi @davideonmeteor,

Sorry for not answering yet - offline data is a different question and I hoping for someone with more experience would be able to answer.

My experience of offline data is very limited, but I have experimented. Search these forums for ‘offline’ and you’ll find a heap of information. persist-collection and Grounddb seem to be the common answers, but they are both relatively old.

1 Like

One of the easiest ways to leverage minimongo without syncing is to use a client-only collection and insert the data from a http or method call manually.

// some client file
const myClientCollection = new Mongo.Collection(null)

// Assuming you get your data in response.data
Meteor.call('some data providing method', [your, params], (error, response) => {
  myClientCollection.insert(response.data)
})

// Now use like any other collection. You have to do the data management yourself though.
1 Like