Background on http frontends

-civetweb frontend

--thread per connection, requires a lot of threads

---qos or priority queuing would block frontend threads

-beast frontend

--boost::beast for http parsing

--boost::asio for async networking/io

--async for accepting connections and reading headers

---good model for qos - can queue requests without blocking threads

--synchronous call to process_request()

---thread per request, still need lots of threads

goal: scale requests independently of threads

-why boost::asio

--doesn't impose a threading model. io_service object is a reactor, call run() from any thread

--mature library, basis for C++ std::net library in Networking TS [1]

--the Extensible Asynchronous Model [2] provides several options for async primitives (callbacks, futures, coroutines)

--boost::asio::spawn() stackful coroutines: "enables programs to implement asynchronous logic in a synchronous manner" [3 http://www.boost.org/doc/libs/1_65_1/doc/html/boost_asio/reference/spawn.html]

proposed librados interfaces for asio [4 https://github.com/ceph/ceph/pull/19054]

--header-only wrapper over librados c++ api

--conform to the Extensible Asynchronous Model, so support the same primitives - see unit tests for examples

--deeper Objecter integration work in progress by Adam Emerson [5]

--gives radosgw a unified interface for async operations over http and rados

async process_request() [6]

-add optional yield_context* argument to process_request()

-beast frontend passes one, civetweb passes nullptr

-any librados calls use new interface when given a yield_context

-requires the yield_context* to be passed everywhere in between

--but we can stash it in req_state to make it available to all ops

-getting started with the easy stuff

--rgw_get_system_obj()

--reading user objects for authentication

--reading bucket/bucket instance objects (common to most s3/swift ops)

-this process leaves a lot of gaps. for example, rgw_get_system_obj() is in tons of call paths without access to a yield_context

--(either outside process_request(), or just aren't hooked up yet)

--just passing 'nullptr' makes it impossible to differentiate the yield_context argument from its 4 other arguments that default to nullptr!

--that makes it impossible to reason about which call paths could run asynchronously

-measurable progress towards full asynchrony

--new vocabulary type 'optional_yield_context' with 'null_yield' for empty value

--null_yield designates a call site that is definitely synchronous

--makes it easy to audit the code and find the pieces that still need conversion

-fighting regression once we're close

--have librados calls log warnings when called synchronously from a beast frontend thread (using a thread_local flag)

--scan those logs in teuthology runs to flag failures

and then?

-vastly reduce the number of frontend threads for beast

-consolidate other background threads

remaining work:

- RGWGetObj waits on AioCompletions - use AioThrottle from PutObj instead

- replace librados IoCtx::operate() calls with rgw_rados_operate() and optional_yield_context

- thread optional_yield_context all the way from beast frontend to rgw_rados_operate() calls
- some cls client calls use IoCtx::operate() directly

- block_while_resharding() sleeps on a condition variable

- no async interface for pool object listings with IoCtx.nobjects_begin()

- libcurl http requests for auth (Keystone and OPA)

[1] "C++ Technical Specification - Extensions for Networking"

http://cplusplus.github.io/networking-ts/draft.pdf

[2] "Library Foundations for Asynchronous Operations"

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3896.pdf

[3] Reference: boost::asio::spawn

http://www.boost.org/doc/libs/1_65_1/doc/html/boost_asio/reference/spawn.html

[4] "librados: add async interfaces for use with boost::asio"

https://github.com/ceph/ceph/pull/19054

[5] "osdc/Objecter: Boost.Asio (I object!)"

https://github.com/ceph/ceph/pull/16715

[6] work in progress branch:

https://github.com/cbodley/ceph/commits/wip-rgw-async-process-171120

Ceph 之 Background on http frontends的更多相关文章

  1. 虚拟机使用ceph-deploy安装ceph

    参考: ceph官网介绍 使用ceph-deploy安装Ceph 12.x 安装虚拟机 首先安装虚拟机环境,虚拟机安装这里不做介绍,本实验使用的镜像为CentOS-7-x86_64-Everythin ...

  2. Ceph常用命令

    目录 [1.环境准备] [2.部署管理] [3.集群扩容] [4.用户管理] [5.密钥环管理] [6.块设备管理] [7.快照管理] [8.参考链接] 简要说明: 最近心血来潮,对分布式存储感兴趣, ...

  3. ceph mimic版本 部署安装

    ceph 寻址过程 1. file --- object映射, 把file分割成N个相同的对象 2. object - PG 映射, 利用静态hash得到objectID的伪随机值,在 "位 ...

  4. Ceph常规操作及常见问题梳理

    Ceph集群管理 每次用命令启动.重启.停止Ceph守护进程(或整个集群)时,必须指定至少一个选项和一个命令,还可能要指定守护进程类型或具体例程. **命令格式如 {commandline} [opt ...

  5. ceph kubernetes中使用

    1.在管理节点上,进入刚创建的放置配置文件的目录,用 ceph-deploy 执行如下步骤 mkdir /opt/cluster-ceph cd /opt/cluster-ceph ceph-depl ...

  6. 1、ceph-deploy之部署ceph集群

    环境说明 server:3台虚拟机,挂载卷/dev/vdb 10G 系统:centos7.2 ceph版本:luminous repo: 公网-http://download.ceph.com,htt ...

  7. CEPH RGW多 ZONE的配置

    相关的名称解释 Region :可以理解为区域,是基于地理位置的逻辑划分:如:华南,华北之类,包含多个region的Ceph集群必须指定一个master region,一个region可以包含一个或者 ...

  8. Ceph 管理和使用

    ceph 管理 上次介绍了Ceph集群架构并且搭建了ceph集群,本节介绍ceph用户认证流程和挂载.cephFS.ceph RBD以及ceph mds高可用 1. ceph 授权流程和用户权限管理 ...

  9. 安装ceph (快速) 步骤二:存储集群

    用 ceph-deploy 从管理节点建立一个 Ceph 存储集群,该集群包含三个节点,以此探索 Ceph 的功能. 创建一个 Ceph 存储集群,它有一个 Monitor 和两个 OSD 守护进程. ...

随机推荐

  1. JavaSE_06_Collection、泛型

    1.Collection集合 1.1 集合概述 数组的长度是固定的.集合的长度是可变的. 数组中存储的是同一类型的元素,可以存储基本数据类型值.集合存储的都是对象.而且对象的类型可以不一致.在开发中一 ...

  2. VS 快捷键和正则替换

    本文在VS2017中可用 1.注释 :Ctrl  K C 取消注释: Ctrl K U 2.整理代码格式: Ctrl K D 或者 Ctrl K F 3.快速切换不同的代码窗口  Ctrl+Tab 4 ...

  3. 数据表中记录明明有,session.get(类.class, id);返回null

    出现null的处理思路首先检查数据库中是否真的有这个记录 确实存在的,用接口查一下最大值,也是存在的,数据库连接正常 写sql也可以查得到 然而诡异的事情出现了 难道是一直在用的dao代码出了问题? ...

  4. Luogu P1312 Mayan游戏(搜索)

    P1312 Mayan游戏 题意 题目描述 Mayan puzzle是最近流行起来的一个游戏.游戏界面是一个\(7\)行\(\times 5\)列的棋盘,上面堆放着一些方块,方块不能悬空堆放,即方块必 ...

  5. 洛谷P5071 此时此刻的光辉

    2s512M. 解:先分解质因数.考虑按照质因数大小是否大于√分类. 大于的就是一个数颜色个数,莫队即可n√m. 小于的直接枚举质因数做前缀和然后O(1)查询.总时间复杂度n(√m + σ(√V)). ...

  6. SQL 约束和表修改语句

    1.约束作用: 约束的目的就是确保表中的数据的完整性 2.常用的约束类型如下 主键约束:(Primary Key constraint) 要求主键列唯一,并且不允许为空    唯一约束:(Unique ...

  7. Google自带截图工具的使用

    转载自:http://chromecj.com/utilities/2017-12/859.html

  8. Cors之带凭据的请求

    带凭据的请求 默认情况下,跨源请求不提供凭据.通过将withCredentials属性设置为true,可以制定某个请求应该发送凭据.

  9. git学习记录——分支管理和多人协作

    在公司里难免会出现多个人一起工作,这就需要构建多个分支派发给多个人去干活 这就产生一个需求,分支管理 分支的创建,合并和删除 其他版本控制系统如SVN等都有分支管理,但是用过之后你会发现,这些版本控制 ...

  10. ThinkPHP中实现微信支付(jsapi支付)流程

    https://blog.csdn.net/sinat_35861727/article/details/72783988 之前写过一篇文章讲了 PHP实现微信支付(jsapi支付)流程 ,详见文章: ...