The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. October 16, 2019, 05:46:56 AM

Login with username, password and session length


Pages: [1] 2 3
  Print  
Author Topic: Master to Slaves OR Slaves to Master  (Read 11965 times)
dbrown
Rookie
**
Offline Offline

Posts: 28


View Profile
« on: July 17, 2008, 01:56:23 PM »

Master to Slaves OR Slaves to Master.

I have a website system that is setup to update each client website settings/files by communicating with a master server at a timed interval.

Imagine I have a million sites that need to be updated daily with data. Can you can think of any pros or cons to Master to Slaves/Slaves to Master

My heart tells me to use the Master to connect to the slaves instead of waiting for the slaves to connect to the master for updates.
« Last Edit: July 17, 2008, 03:31:53 PM by dbrown » Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #1 on: July 17, 2008, 02:17:06 PM »

have the master tell the slaves to phone home for an update.
basically think of it like a trigger.

I have a few dozen sites  ROFLMAO
those all just do their thing, never phoning home, except for certain 'in process' reasons, or when the MCP hits them with a specially formulated magical super sekret string that tells that site to phone home for a multitude of things, such as, sending in traffic logs, getting code updates, getting interlink info, etc etc. its pretty sweet, but it gets a bit confusing in the debugging.

the reason why this is slightly better than the slave on a timer thing, is if your timer breaks, your slave never phones home. Or if your slave breaks, its gone.
This reduces hits on your MCP as well, since most of the time, i would guess that you dont actually want the slaves phoning home when they do.
Another reason is that you can track it. You can tell a remote to phone home, store the time or a bit in a database, when the remote actually succeeds in phoning home, and completes the task, update the database to reflect it. That way you can see which of your little kiddies never found its way home, and you can investigate.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #2 on: July 18, 2008, 03:23:55 PM »

Nutballs hints at another important consideration here, from a paranoid perspective: Personally, I try to never push anything at my slaves, on the notion that a malicious snooper could then push or modify them as well. They always call home.

However, the timing of calling home is not defined by the slaves. The master "pings" a slave and it then calls home, which keeps cycling and timing in central control, but also maintains the security of the slave always point to the master (and nowhere else) and then pulling instructions rather than me pushing it at the slave.

The added benefit of this mechanism is that I can adjust my timing in an ad hoc fashion... I can slow everything down or quicken it up, shut it down for a while, "limp" through my clients or pulse many at a time and then go quiet. This method keeps the meat of the processing cost on the slave side (which is probably what compels you to go this way) but the control over that processing cost at the server side.


/p
« Last Edit: July 18, 2008, 03:25:33 PM by perkiset » Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #3 on: July 22, 2008, 09:43:38 AM »

You can push instructions to my slaves if you can figure out how to generate the correct key. Pro tip though: You won't.
Logged

hai
dbrown
Rookie
**
Offline Offline

Posts: 28


View Profile
« Reply #4 on: July 22, 2008, 01:24:58 PM »

Thanks. I already got half of the update system working based on the advice above. I have a pretty good content generation system (perk seems to agree) in place and my cloaking is all set now. My "new" system is good enough to start deploying. I figure if I get the master slave/auto update thing working, I can constantly add features while teh hired helpers are adding sites. Mobster

PS.. Did any of you put in a system to randomize the client site/s fingerprint? I did
« Last Edit: July 22, 2008, 01:30:09 PM by dbrown » Logged
sysbuilder
Rookie
**
Offline Offline

Posts: 17


View Profile
« Reply #5 on: July 23, 2008, 08:25:32 AM »

Noob question here: I have no experience setting up master/slave servers relationships (the only material I've really read on the subject is setting up masters and slaves with MySQL), and I'm trying to imagine how I would perform the actual "calling home" in PHP.

I'm curious, do you guys perform the communication like an XML-RPC HTTP call, or more along the lines of fsockopen, etc.?
Logged

No links in signatures please
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #6 on: July 23, 2008, 09:03:17 AM »

i actually do it as a pure get and echo, so think of a rest query.

but you of course need to know the supersekret handshake.

When I need to deploy a code update to all my slaves, I hit each of them with a get that triggers the phone home.
When they phone home, they do a get via curl or some other process as well which contains, what they want, why they want it, secret key, and a bunch of other crap which is not relevant here.
Then my master replies back with what they asked for, as just a raw echo of a full PHP file assuming a new code base is what is requested.
Then to make sure everything actually happened the way it should, the slave phones home again with a "got it, done!" type message, and I set it as done in the database. Otherwise, I can see which sites failed to actually get the update.

I actually reply back with a bunch of different things, sometimes clear text, like in the case of a new code base, sometimes XML, like in the case of links and redirect targets, and sometimes a serialized string of crap.
It all depends on what I am specifically doing, and mood I was in when I wrote that function... lol

you could do it like an RPC call, but frankly, since you are controlling the whole show, I see that as overkill.

the only thing you need to make sure of, is that you build in a way to do a complete reset in case things go wonky.
in otherwords, the file that does your site functionality, should NOT be the file that you deploy the code updates through, or at least not be the only file that does it.

I have 1 file on each slave, that is my traffic cop file. All requests go through it, and it listens for 1 specific thing in the URL. if that thing is not seen, it includes the codebase file, and runs like normal. so for example, i have index.php which is the traffic cop, and then code.php which is the actual site functionality. All the traffic cop is capable of doing is writing a new code file, nothing more. it is very small, and single purposed.

XMLRPC would possibly be a bit more secure, but frankly, in this situation, security is merely an illusion. encrypting, POST, convolution, whatever, is not going to protect against someone with full and willful intent to get in. The only thing you can do is to make sure they can't change the traffic cop file, and they cant get backwards into your Master to do harm. Slaves are disposable, you don't WANT to lose them, but you should expect that you COULD lose them, though quite unlikely.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: July 23, 2008, 11:43:56 AM »

Holy smokes... I was all set to respond, but Nuts has said it all.

And WOW I need to get a hold of whatever Colombians beans the JBomb is using to grind up your Joe in the morning...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #8 on: July 23, 2008, 11:45:59 AM »

lol. Its that damn infant. It creates enough noise and distraction that my ADD brain can actually think. go figure...

but Tully's Full City Roast does the trick Wink
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #9 on: July 24, 2008, 06:19:03 AM »

lol. Its that damn infant. It creates enough noise and distraction that my ADD brain can actually think. go figure...

but Tully's Full City Roast does the trick Wink

In a Keurig?

I love my Keurig.
Logged

hai
sassy bear
Rookie
**
Offline Offline

Posts: 21


Sassy Bear


View Profile
« Reply #10 on: July 24, 2008, 06:48:00 AM »

lol. Its that damn infant. It creates enough noise and distraction that my ADD brain can actually think. go figure...

but Tully's Full City Roast does the trick Wink

In a Keurig?

I love my Keurig.

The ONLY way to make coffee is in a french press, with almost boiling water as to not burn the beans and to capture the essence of the brew.  Also the only coffee to ever order is the sumatra from http://www.veritascoffee.com one sip and youll never go back to mud water.
Does better than prescription ADD meds IMO.  ROFLMAO
Logged
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #11 on: July 24, 2008, 06:51:51 AM »

lol. Its that damn infant. It creates enough noise and distraction that my ADD brain can actually think. go figure...

but Tully's Full City Roast does the trick Wink

In a Keurig?

I love my Keurig.

Maybe the infant is distracting your distractor?  hee hee
Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #12 on: July 24, 2008, 07:18:53 AM »

lol@jam true

I was loving my kuerig. great Customer Service btw (3 new units for the price of 1. lol)
but those Kups are expensive. I now use the make your own coffee thingy in the Kuerig, which works pretty well. Obviously take a bit longer since I have to put coffee in it, but much cheaper.

French press makes good coffee, but too messy.
A drip makes too much coffee
a melita single serve drip, is too slow. pouring water for more than 5 seconds is not my idea of well spent time.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #13 on: July 24, 2008, 07:28:45 AM »

wow the dork factor just went through the roof on that one.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
sassy bear
Rookie
**
Offline Offline

Posts: 21


Sassy Bear


View Profile
« Reply #14 on: July 24, 2008, 07:39:38 AM »

Ill stick with my bring home starbucks and made in china espresso machine..
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!