Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to properly coordinate a sole task between multiple processes on many servers
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tom  
View profile  
 More options Oct 5 2012, 8:04 am
From: Tom <tommed...@gmail.com>
Date: Fri, 5 Oct 2012 05:04:58 -0700 (PDT)
Local: Fri, Oct 5 2012 8:04 am
Subject: How to properly coordinate a sole task between multiple processes on many servers

I've setup a cluster of physical servers. Each server runs exactly the same
code. Moreover, each server runs multiple node processes using the build
in cluster functionality.

I use MongoDB (native) to share information between processes and servers.
However, I am having some difficulty with running a special task that needs
to be executed only once during initialization:

> if a special `admin` account does not yet exist in the database, it

should be created

Originally I figured that I could read from the MongoDB master server on
each node and check if the admin account already exists. If it does not
then another node has not yet created it, so this node should do so.
However this is problematic because creating an admin password hash is
asynchronous and takes time. Therefore there is a delay between when a node
decides to create the account and when the account is being found by other
nodes when querying the database.

The code snippet that reads from the Mongo master only and creates the
account is available here: https://gist.github.com/3839429

In the future I would also like a special task to be executed every 5
minutes. This task must then only be executed by a running server, and not
by all servers.

In short: when running a cluster of servers, how do you coordinate between
these servers which of them is going to execute a sole task such as the one
described above?

Tom


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.