[PATCH] SMP Cache Manager, Phase2

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Wed, 13 Oct 2010 23:09:13 -0600

SMP Cache Manager, Phase2 implementation.

Cache Manager actions are forwarded to Coordinator. Coordinator iterates
over Kids, aggregating their stats if possible and/or allowing each kid
to dump non-aggregatable output directly into response if needed.
Non-aggregated output is wrapped in "by kidN { ... } by kidN" markup to
ease auto-processing.

Old code both computed and dumped stats to Store at the same time. To
avoid computing code duplication, we now collect stats in primitive
Stats objects and then either dump those to Store or send them to
Coordinator for aggregation and, eventual Store dump. What stats to
collect, when to aggregate, and when to dump is decided by
action-specific Mgr::Action classes.

The Cache Manager menu now consists of ActionProfile objects.
ActionProfile maintains hard-coded information about specific actions.
It uses ActionCreator member to create Action objects when a cache
manager request is received.

Added Mgr::ActionParams class to maintain action parameters, including
HTTP request details necessary for Store entry creation (in another
strand) and action-specific parameters (currently just credentials). In
Phase3, this class can be extended to supply more parameters such as kid
IDs to which the action should apply.

Added Mgr::Command that combines hard-coded ActionProfile details with
user-specified ActionParams. This simplifies many interfaces because we
no longer need to supply a long list of parameters, covering various
parts of action config.

Moved Cache Manager registration to Mgr::RegisterAction() globals to
reduce dependency on the CacheManager class, which is a singleton
anyway, and which is unused by most of the registration callers. On the
other hand, without this change, no legacy (function-based actions) code
would have been changed!

Enhanced TypedMsgHdr class to simplify storing and loading non-POD
classes. The caller can now easily handle a non-POD class as a series of
put/get calls, one for each POD member. This was necessary to send
Mgr::ActionParams to Coordinator and back. Will probably be useful for
sending other complex structures as well.

Reconfigure, shutdown, and other "basic" actions have been moved to
src/mgr/BasicActions.cc. Mgr::RegisterBasics() registers them.

Most of the Cache Manager code is now in src/mgr/.

Many more polishing touches.

More polishing left for future projects: Move CacheManager to Mgr
namespace and src/mgr/ directory. Use SBuf instead of String for
ActionParams and TypedMsgHdr. Rename Ipc::TypedMsgHdr to Ipc::Msg,
Ipc::SocketMsg, or similar because it maintains more than just msghdr
struct. Fix #include order in old source files affected by the
Mgr::RegisterAction change. More action aggregation and Phase3 changes.

Based on lp 3p2-plus branch, revision 10833 (synced with trunk r10898).

Received on Thu Oct 14 2010 - 05:09:36 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 14 2010 - 12:00:04 MDT