Cloud Controller Design

VCAP Cloud Controller Design
============================


Overview
--------
This version of the Cloud Controller is being redone from the ground up. While
we are generally not in favor of wholesale rewrites of components and prefer to
refactor in place, this is somewhat difficult with the previous CC code base
for a few reasons.  1) the rest of CF uses Sinatra rather than Rails and we
want to unify our http framework, 2) we are converging on Sequel rather than
Active Record for our ORM, so we want to unify this in the CC, 3) the previous
CC used hybrid event/fiber based concurrency model that cause a lot of issue
with developers accidentally blocking the event loop.  While I'm generally in
favor of evented and/or fiber based systems when running at high levels of
concurency, the CC does not fit that usage pattern, so the trade offs are not
worth it.  A thread per request is perfectly fine for the CC and avoids having
to worry about eventloop blocking issues.


It should be noted that while what is left of the previous CC is now going
through a rewrite, we have actually been somewhat doing a refactoring in place
since the initial release.  We wanted to move staging, auth/authz, and resource
managment out of the CC. That happened in the context of the previous CC and
major sections of CC code were turned off.  The remaining app state management
of the CC is the focus of this rewrite.


High Level Architecture
-----------------------
The high level architecture of this version of the CC can be sumarized as
follows:


* Sinatra HTTP framework.
* Sequel ORM
* Thread per request (currently using Thin in threaded mode)
* NATS based communication with other CF components


Performing NATS communication in a threaded model requires an adapter between
concurrency models.  This is done by adding an EventMachine#schedule_sync method
which is run on a thread other than the reactor thread, i.e. a thread for a
request or some other worker thread pool, and runs the provided block in the
reactor thread.  It blocks the calling thread on the result and will return the
result of the block or re-throw an exception if the calling thread if
necessary.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值