CPU usage is going up


#21

Correct, you would want to create a compound index, something like this

Posts._ensureIndex({
 type:1,
 x: 1,
 y: 1,
 last_activity: 1
});

Let me know if that helps


#22

If you are using Blaze, create a template helper
I think that way, it will be reactive.


#23

Where is this code you posted, the client? An index will only help server side. If you publish/subscribe in the standard way, the client should see reactive updates to the collection via the reactivity of the cursor returned by find on the client


#24

Sorry, this code is indeed server side. The server calculates a players X and Y, and pushes back data between an X and Y value. Simple video game logic.

The file is /imports/posts.js wrapped in an Meteor.isServer{

Question: If the value of X and Y are changing all the time, up to 1 time per second, I can still index for performance gains yes?


#25

Sure am!

I’ve got the template helper, but for some reason it doesn’t get new data. Perhaps it’s a simple mis-configuration. I’ve put it off exploring for a while until I got other bugs and deployment server worked out; revisiting now. I’ve learned so much!


#26

Great vid on indexing,


#27

Your linode has probably been compromised since they don’t set you up with SSH keys initially. Had this a few times!