Comments (2)
It's very tricky to run these kind of stuff. This is not only for cores,
think what will be happen when you are running multiple servers of your app.
Here's a way to to that.
- Inside every worker there's a env variable called
CLUSTER_WORKER_ID
.
Try to create the observer when there is no such worker - When you are running multiple servers, expose a new env for only one
server. And check for that env as well. - So, this observer runs on a single server and single core.
You can even look at some other stuffs like, doing these things as a job
queue or running different app.
On Fri, May 1, 2015 at 1:49 AM Vu Pham [email protected] wrote:
I'm running to an issue that I have an Mongo update query in startup code
of server:if (Meteor.isServer) {
Meteor.startup(function(){
Posts.find().observeChanges({
added: function(id, fields) {
Authors.update({_id: fields.authorId}, {$inc: {count: 1}});
}
})
});
}I run app with 4 cores server and this added event run 4 times which I
expected just 1.
Is there a way in app that we can detect current running core? Or any
other best practices to run observerChanges in multicore environment?—
Reply to this email directly or view it on GitHub
#51.
from cluster.
Thanks @arunoda I think I'd better run this in a microservice then.
However that env variable is nice as well. 👍
from cluster.
Related Issues (20)
- Using domain name in ROOT_URL cause websocket issue HOT 4
- Has @arunoda gone missing? HOT 1
- Can a cluster node signal that it is busy? HOT 2
- FATAL ERROR: JS Allocation failed - process out of memory HOT 2
- Page refreshes endlessly in a browser after editing coffee/jade files HOT 2
- make cluster work with cordova
- WebSockets for Everyone
- Refresh requires App restart HOT 4
- After login this.connection inside publish is missing keys, for example this.connection.host is undefined
- 3 Windows Server VM with 3 meteor intances ( QUESTION)
- Fault tolerance available?
- FATAL ERROR: Evacuation Allocation failed - process out of memory HOT 1
- Meteor logging ceases after switch over
- How do I uninstall cluster HOT 2
- CLUSTER_ENDPOINT_URL isn't automatically set with new Meteor Up HOT 1
- Cant connect in Meteor 1.4.2.1
- Load balance multi service of the same app.
- is this project dead? HOT 6
- Module not working anymore HOT 4
- MongoDB depedency is breaking cluster
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cluster.