Commit Graph

711 Commits

Author SHA1 Message Date
Brion Vibber
0e852def6a XMPP queued output & initial retooling of DB queue manager to support non-Notice objects.
Queue handlers for XMPP individual & firehose output now send their XML stanzas
to another output queue instead of connecting directly to the chat server. This
lets us have as many general processing threads as we need, while all actual
XMPP input and output go through a single daemon with a single connection open.

This avoids problems with multiple connected resources:
* multiple windows shown in some chat clients (psi, gajim, kopete)
* extra load on server
* incoming message delivery forwarding issues

Database changes:
* queue_item drops 'notice_id' in favor of a 'frame' blob.
  This is based on Craig Andrews' work branch to generalize queues to take any
  object, but conservatively leaving out the serialization for now.
  Table updater (preserves any existing queued items) in db/rc3to09.sql

Code changes to watch out for:
* Queue handlers should now define a handle() method instead of handle_notice()
* QueueDaemon and XmppDaemon now share common i/o (IoMaster) and respawning
  thread management (RespawningDaemon) infrastructure.
* The polling XmppConfirmManager has been dropped, as the message is queued
  directly when saving IM settings.
* Enable $config['queue']['debug_memory'] to output current memory usage at
  each run through the event loop to watch for memory leaks

To do:
* Adapt XMPP i/o to component connection mode for multi-site support.
* XMPP input can also be broken out to a queue, which would allow the actual
  notice save etc to be handled by general queue threads.
* Make sure there are no problems with simply pushing serialized Notice objects
  to queues.
* Find a way to improve interactive performance of the database-backed queue
  handler; polling is pretty painful to XMPP.
* Possibly redo the way QueueHandlers are injected into a QueueManager. The
  grouping used to split out the XMPP output queue is a bit awkward.
2010-01-21 22:40:35 -08:00
Evan Prodromou
10f21e1f41 add class and function doc comments to PuSH plugin 2010-01-20 16:37:41 -05:00
Evan Prodromou
0167ff6d27 whitespace changes to make phpcs happy for PuSH plugin 2010-01-20 16:29:11 -05:00
Evan Prodromou
1d37a6c428 correctly get replies for a notice in PuSH plugin 2010-01-20 16:16:22 -05:00
Evan Prodromou
365b0b1e14 use standard plugin configuration for PubSubHubBub 2010-01-20 16:13:52 -05:00
Evan Prodromou
dbccebb14b update friends, not user, timeline for recipients of notice in PuSH plugin 2010-01-20 15:43:24 -05:00
Brion Vibber
775c63b654 Cleanup for memcached host/port split -- apparently we use ';' on purpose, restoring. Keeping fix for the notices spewing into the log. 2010-01-16 13:39:05 -08:00
Brion Vibber
5783874cc2 Clean up host/port separation in memcached plugin -- use : not ; as separator and clean up some warnings 2010-01-14 14:14:32 -08:00
Brion Vibber
b25deaacea queue daemon fixes: path fix for xmpp, suppress warning in memcached init 2010-01-13 21:24:36 -08:00
Craig Andrews
681065d734 Made the IMAP plugin work in the style of the new queue/iomanagers 2010-01-13 15:35:53 -05:00
Zach Copley
c3188fd1fe Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-13 19:17:49 +00:00
Zach Copley
43170b3d18 When Twitter bridge encounters a 403 (rate limit) err, drop the notice
instead of requeuing.
2010-01-13 19:17:40 +00:00
Evan Prodromou
f2e9469e16 throttle subscriptions 2010-01-13 03:11:31 -08:00
Evan Prodromou
436b8c845e Merge branch '0.9.x' into inblob 2010-01-12 23:53:52 -08:00
Evan Prodromou
e34ece8b06 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-12 23:25:25 -08:00
Brion Vibber
ec145b73fc Major refactoring of queue handlers to support running multiple sites in one daemon.
Key changes:
* Initialization code moved from common.php to StatusNet class;
  can now switch configurations during runtime.
* As a consequence, configuration files must now be idempotent...
  Be careful with constant, function or class definitions.
* Control structure for daemons/QueueManager/QueueHandler has been refactored;
  the run loop is now managed by IoMaster run via scripts/queuedaemon.php
  IoManager subclasses are woken to handle socket input or polling, and may
  cover multiple sites.
* Plugins can implement notice queue handlers more easily by registering a
  QueueHandler class; no more need to add a daemon.

The new QueueDaemon runs from scripts/queuedaemon.php:

* This replaces most of the old *handler.php scripts; they've been refactored
  to the bare handler classes.
* Spawns multiple child processes to spread load; defaults to CPU count on
  Linux and Mac OS X systems, or override with --threads=N
* When multithreaded, child processes are automatically respawned on failure.
* Threads gracefully shut down and restart when passing a soft memory limit
  (defaults to 90% of memory_limit), limiting damage from memory leaks.
* Support for UDP-based monitoring: http://www.gitorious.org/snqmon

Rough control flow diagram:
QueueDaemon -> IoMaster -> IoManager
                           QueueManager [listen or poll] -> QueueHandler
                           XmppManager [ping & keepalive]
                           XmppConfirmManager [poll updates]

Todo:

* Respawning features not currently available running single-threaded.
* When running single-site, configuration changes aren't picked up.
* New sites or config changes affecting queue subscriptions are not yet
  handled without a daemon restart.
* SNMP monitoring output to integrate with general tools (nagios, ganglia)
* Convert XMPP confirmation message sends to use stomp queue instead of polling
* Convert xmppdaemon.php to IoManager?
* Convert Twitter status, friends import polling daemons to IoManager
* Clean up some error reporting and failure modes
* May need to adjust queue priorities for best perf in backlog/flood cases

Detailed code history available in my daemon-work branch:
http://www.gitorious.org/~brion/statusnet/brion-fixes/commits/daemon-work
2010-01-12 20:45:09 -08:00
Brion Vibber
9c34d5c107 Actually skip the pingback if XML-RPC extension is missing, instead of considering it then trying anyway and dying of a fatal error. :) 2010-01-12 12:12:31 -08:00
Evan Prodromou
ecb3abf84c Merge branch '0.9.x' into inblob 2010-01-11 16:28:27 -08:00
Evan Prodromou
7e5c15fa80 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-11 16:23:48 -08:00
Evan Prodromou
04c76fc4e5 safer storage for diskcacheplugin 2010-01-11 16:23:34 -08:00
Brion Vibber
116c5f6839 dos -> unix line endings on CasAuthentication's CAS library 2010-01-11 15:42:17 -08:00
Evan Prodromou
bd6571c2e1 Merge branch 'diskcache' into 0.9.x 2010-01-11 15:34:27 -08:00
Sarven Capadisli
aaea2b1a96 Apparently, I can't spell my family name. 2010-01-11 13:02:04 +01:00
Evan Prodromou
8809e577b2 Merge branch 'sessionidparam' into 0.9.x
Conflicts:
	lib/command.php
2010-01-11 00:45:26 -08:00
Evan Prodromou
92deb35bc4 inject session before redirect for openid finish login 2010-01-11 08:40:41 +00:00
Craig Andrews
a07d8dab25 i18n in the imap plugin 2010-01-09 19:04:53 -05:00
Craig Andrews
c758b1b1d4 Add version information to a bunch of plugins 2010-01-09 19:04:53 -05:00
Evan Prodromou
2db840b2f5 use Inbox in twitterstatusfetcher 2010-01-09 14:02:01 -08:00
Evan Prodromou
d902de139c change PuSH plugin to use whoGets() 2010-01-09 13:59:39 -08:00
Evan Prodromou
9cfea6d051 use whoGets() for realtime plugin 2010-01-09 13:56:54 -08:00
Craig Andrews
055f3fdddb Add an IMAP daemon so StatusNet can process incoming user posts via catch-all mailbox (in addition to the pre-existing script alias method) 2010-01-08 18:52:43 -05:00
Evan Prodromou
e22af049a8 persistent connection flag, default false on cli 2010-01-08 13:21:29 -08:00
Sarven Capadisli
647bbb916c Updated RealtimePlugin to use core json2.js 2010-01-08 13:36:31 +00:00
Sarven Capadisli
ce761c7142 Updated plugin info for PoweredByStatusNet 2010-01-08 11:42:03 +00:00
Evan Prodromou
4f62d685d0 Mapstraction PluginVersion 2010-01-08 00:38:20 -08:00
Evan Prodromou
c57fe7fbf5 PluginVersion for WikiHashtags 2010-01-08 00:29:09 -08:00
Evan Prodromou
87043797bf Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-08 00:21:58 -08:00
Evan Prodromou
054aaa40bf add versions for url-shortener plugins 2010-01-08 00:20:38 -08:00
Zach Copley
20af83d316 Add version info for Facebook, TwitterBridge and RSSCloud plugins 2010-01-08 00:09:23 -08:00
Evan Prodromou
11b19788f5 add version information to GeoURL 2010-01-07 17:58:48 -08:00
Evan Prodromou
fe01a7d183 add version information to Linkback 2010-01-07 17:58:38 -08:00
Evan Prodromou
87c181b4e3 add version information to GoogleAnalytics 2010-01-07 17:51:57 -08:00
Evan Prodromou
ca3b2d614a add version information to MemcachePlugin 2010-01-07 17:49:39 -08:00
Evan Prodromou
6395ac71b8 add version information to PiwikAnalyticsPlugin 2010-01-07 17:47:23 -08:00
Evan Prodromou
afaefa6942 add version info to the Template plugin 2010-01-07 17:43:56 -08:00
Evan Prodromou
0587dcc045 add version info to OpenID plugin 2010-01-07 17:41:55 -08:00
Evan Prodromou
1c824a52ec Add version info to the CacheLog plugin 2010-01-07 17:39:15 -08:00
Evan Prodromou
42834944e0 add version info to SamplePlugin 2010-01-07 17:37:44 -08:00
Evan Prodromou
ff930d2555 add version information to Geonames plugin 2010-01-07 17:27:01 -08:00
Evan Prodromou
a55939f3b1 Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x 2010-01-06 23:23:30 -08:00