root/trunk/RebuildQueue/README.txt @ 171

Revision 171, 7.2 kB (checked in by bchoate, 3 years ago)

Updated release to v1.04.

  • Property svn:keywords set to Id Revision
RevLine 
[85]1Rebuild Queue
[171]2Version 1.04
[85]3
4
5Summary
6=======
7
8The Rebuild Queue plugin is designed to let you shift the rebuilding
9operations typically done by Movable Type to one or more "offline"
10processes.
11
12With this plugin, you can fine-tune your building operations so they
13are distributed and distribute the built pages across any number of
14servers.
15
16
17Requirements
18============
19
[89]20Movable Type version 3.3 or later (or Movable Type Enterprise).
21
[164]22The 'rsync' command if using remote server synchronization. (see: http://samba.anu.edu.au/rsync/)
[85]23
[164]24Time::HiRes (see: http://search.cpan.org/dist/Time-HiRes/)
[85]25
26Installation
27============
28
29To install, place the "RebuildQueue" directory in this distribution
30underneath your Movable Type "plugins" directory. Once the files are
31physically installed, accessing Movable Type will trigger an upgrade
32procedure which will install the plugin's table into your database.
33
34The plugin files, once installed should match that shown below:
35
36    MT_DIR/
[86]37           mt-static/
38                     RebuildQueue/
39                                  rebuildq.gif
[85]40           plugins/
41                   RebuildQueue/
42                                lib/
43                                    RebuildQueue/
44                                                 Daemon.pm
45                                                 File.pm
46                                                 Plugin.pm
47                                                 Publisher.pm
48                                RebuildQueue.pl
49
50
51All files should have permission that make them readable by the
52web server and/or account being used to invoke the offline
53RebuildQueue.pl script (644 permissions); the RebuildQueue.pl
54script should be executable (755 permissions).
55
56Once the installation is complete, you are ready to configure the
57plugin.
58
59
60Configuration
61=============
62
63Global Configuration Options
64----------------------------
65
66Navigate to the Plugin listing from the MT System Overview menu. There you
67will find an entry for the Rebuild Queue plugin. Click the "Show Settings"
68link to reveal the global configuration settings.
69
70"Number of Workers": This setting lets you define how many rebuild "worker"
71processes you plan to run. The default number is 1, but you can increase
72this number if you wish. When the Rebuild Queue schedules a page to be
73rebuilt, it can randomly assign the task to one of the worker processes. This
74helps distribute the rebuilding load across multiple processes or servers.
75
76Weblog Configuration Options
77----------------------------
78
79To enable the Rebuild Queue, you must go to the weblog(s) you wish it to
80manage and enable it for each of them. From the Weblog Settings page, go
81to the "Plugins" tab and click the "Show Settings" link for the Rebuild Queue
82entry listed there. The following settings are available at the weblog level:
83
84"Enable for this Weblog?": Check this option to enable the Rebuild Queue to
85manage rebuilding for that weblog.
86
87"Force Building to Worker": If you have configured (at the global level) 2
88or more worker processes, you will see this option. It lets you assign any
89queued build operations for this weblog to a particular worker. This gives
90you control over which worker process builds the weblog instead of it being
91randomly distributed.
92
93Cron Jobs and Daemon Processes
94------------------------------
95
96Since rebuilding is done separately, it's important to set up the
97Rebuild Queue processes to do the actual rebuilding operations and
98mirroring you may require.
99
100The RebuildQueue.pl script is used to run these processes. Running
101RebuildQueue.pl without any options will show the command usage.
102
103A typical cron job for the RebuildQueue itself might be something like this:
104
[162]105*/15 * * * * cd /path/to/RebuildQueue; ./RebuildQueue.pl
[85]106
107This will invoke the Rebuild Queue every 15 minutes to build any pages that
108have been modified since the last execution. Of course, you can invoke it
109more often than that if you prefer.
110
[162]111*/15 * * * * cd /path/to/RebuildQueue; ./RebuildQueue.pl -sync -to user@hostname:
112 
[85]113This cron job will handle the rsync job to copy content from the local
114server to another.
115
[162]116*/15 * * * * cd /path/to/RebuildQueue; ./RebuildQueue.pl -daemonize
[85]117
118This will invoke the Rebuild Queue process as a daemon; that is, it will
119remain running until the process has been halted. This may be preferable
120since it will see pending rebuild requests almost immediately and handle
121them sooner. It only allows one daemon to run, so setting it up on a cron
122job is a way to make sure the daemon process is always running, even if
123it is killed for one reason or another.
124
[162]125*/15 * * * * cd /path/to/RebuildQueue; ./RebuildQueue.pl -daemonize -worker 2
[85]126
127This sets up a second worker daemon. I said only one daemon can run, but
128that only applies by worker id (the default worker id is 1). So you can't
129have multiple daemons running with the same worker id, but you may run as
130many workers as you want.
131
132As long as the database is shared (or you can replicate to multiple
133databases), the Rebuild Queue daemons can be running on totally different
134servers and then syncing to the others in your web farm.
135
136You may also want to 'nice' these processes so they don't overpower the
137server when they wake up to do some work.
138
139Throttling
140----------
141
142You may also throttle the rebuilding of certain templates or types of
143templates. That is, you may want to limit the rebuilding of category
144archives to once per day.
145
146    ./RebuildQueue.pl -throttle category=8640
147
148Throttle times are given in seconds.
149
150Or perhaps you want to only build a given template once every hour,
151regardless of how many times it is requested to rebuild through the MT
152interface or comment system. The template's id is 10.
153
154    ./RebuildQueue.pl -throttle 10=360
155
156You may repeat the -throttle switch as many times as you require to
157specify your rules.
158
159
160Example
161=======
162
163Lets say you have a few weblogs that are used to publish a set of media
164web sites. The pages published are fairly heavy with content and/or
165comments and take time to process, so you want to shift that work to
166the Rebuild Queue instead. You also have 3 web servers that handle visitor
167traffic and 1 that is used by your bloggers to publish the content.
168
169    mt.zine.com (MT installation)
170    www, www2, www3.zine.com (web farm for visitors; load balanced)
171
172On mt.zine.com, you'd have your typical MT installation plus the Rebuild
173Queue plugin.
174
175You set up a cron job that runs the Rebuild Queue daemon.
176
[163]177*/15 * * * * cd /path/to/RebuildQueue; ./RebuildQueue.pl -daemonize
[85]178
179You also set up a cron job that handles syncing to the web servers:
180
18110,25,40,55 * * * * /path/to/RebuildSync.sh
182
183RebuildSync.sh is a custom script, containing:
184
185    #!/bin/sh
186    cd /path/to/RebuildQueue
187    RSYNC_RSH=ssh
188    ./RebuildQueue.pl -sync -to user@www: -to user@www2: -to user@www3:
189
190The sync command takes all files that the Rebuild Queue daemon has rebuilt
191and rsyncs them to the servers you specify. Note that the physical file
192paths as they exist on the "mt.zine.com" server must be the same on the
193other servers to match up.
194
195
196Availability
197============
198
199The latest release of this plugin can be found at this address:
200
201    http://code.sixapart.com/
202
203
204License
205=======
206
207This plugin is released under the Artistic License.
208
209
210Authors
211=======
212
213Brad Choate and Jay Allen of Six Apart
214
Note: See TracBrowser for help on using the browser.