Skip to content
Permalink
Browse files
bRPC website 1.0
  • Loading branch information
huxiguo authored and huxiguo committed Jan 30, 2022
1 parent 7b0c1de commit 92b925e8fd3d8cd6c4fa35c4952566725017b914
Showing 225 changed files with 301 additions and 304 deletions.
BIN +0 Bytes (100%) .DS_Store
Binary file not shown.
@@ -65,71 +65,6 @@ <h3 class="section-head">You can use it to:</h3>
</div>
</div>

<div id="overview">
<div class="contain" style="width: auto; margin: 0 auto">
<h2 class="section-head">Used by</h2>
<h3>Providing your info on <a href="https://github.com/apache/incubator-brpc-website/issues/1307">Wanted: who’s using bRPC</a> to help improving bRPC better</h3>

<td align="center" valign="middle">
<a href="http://home.baidu.com/index.html" target="_blank">
<img width="222px" src="/images/community/baidu_logo.svg">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.iqiyi.com" target="_blank">
<img width="222px" src="/images/community/iqiyi_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://bytedance.com/zh/" target="_blank">
<img width="222px" src="/images/community/bytedance_logo.svg">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.bilibili.com/" target="_blank">
<img width="222px" src="/images/community/bilibili_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://bigo.tv/" target="_blank">
<img width="222px" src="/images/community/bigo_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.didiglobal.com/" target="_blank">
<img width="222px" src="/images/community/didi_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.capitalonline.net/" target="_blank">
<img width="222px" src="/images/community/cdsshouyun_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.amap.com/" target="_blank">
<img width="222px" src="/images/community/gaode_logo.png">
</a>
</td>
<td align="center" valign="middle">
<a href="https://www.weibo.com" target="_blank">
<img width="222px" src="/images/community/weibo_logo.svg">
</a>
</td>
</div>
</div>

<div id="overview">
<div class="contain">
<p>
<img src="/images/egg-logo.png" width="400px" alt="Cloud Native Computing Foundation" title="Cloud Native Computing Foundation">
</p>
<p>
bRPC is an <a href="http://incubator.apache.org/">Apache</a> incubation project.
</p>
</div>
</div>


<!--
{{< blocks/section >}}
<div class="col">
BIN +0 Bytes (100%) content/en/docs/.DS_Store
Binary file not shown.
@@ -14,11 +14,11 @@ Following 2 screenshots show accesses to builtin services from a web browser and

**From a web browser**

![img](../images/builtin_service_more.png)
![img](/images/docs/builtin_service_more.png)

**From a terminal**

![img](../images/builtin_service_from_console.png)
![img](/images/docs/builtin_service_from_console.png)

# Security Mode

@@ -46,19 +46,19 @@ To avoid potential attacks and information leaks, builtin services **must** be h

[/version](http://brpc.baidu.com:8765/version) shows version of the server. Call Server::set_version() to specify version of the server, or brpc would generate a default version like `brpc_server_<service-name1>_<service-name2> ...`

![img](../images/version_service.png)
![img](/images/docs/version_service.png)

[/health](http://brpc.baidu.com:8765/health) shows whether this server is alive or not.

![img](../images/health_service.png)
![img](/images/docs/health_service.png)

[/protobufs](http://brpc.baidu.com:8765/protobufs) shows scheme of all protobuf messages inside the server.

![img](../images/protobufs_service.png)
![img](/images/docs/protobufs_service.png)

[/vlog](http://brpc.baidu.com:8765/vlog) shows all the [VLOG](streaming_log.md#VLOG) that can be enabled(not working with glog).

![img](../images/vlog_service.png)
![img](/images/docs/vlog_service.png)

/dir: browses all files on the server, convenient but too dangerous, disabled by default.

@@ -52,8 +52,8 @@ channel_short_socket_count: 0

典型截图分别如下所示:

单连接:![img](../images/single_conn.png)
单连接:![img](/images/docs/single_conn.png)

连接池:![img](../images/pooled_conn.png)
连接池:![img](/images/docs/pooled_conn.png)

短连接:![img](../images/short_conn.png)
短连接:![img](/images/docs/short_conn.png)
@@ -28,12 +28,12 @@ r31906后brpc支持contention profiler,可以分析在等待锁上花费了多

我们通过实际例子来看下如何使用contention profiler,点击“contention”按钮(more左侧)后就会开启默认10秒的分析过程。下图是libraft中的一个示例程序的锁状况,这个程序是3个节点复制组的leader,qps在10-12万左右。左上角的**Total seconds: 2.449**是采集时间内(10秒)在锁上花费的所有等待时间。注意是“等待”,无竞争的锁不会被采集也不会出现在下图中。顺着箭头往下走能看到每份时间来自哪些函数。

![img](../images/raft_contention_1.png)
![img](/images/docs/raft_contention_1.png)

上图有点大,让我们放大一个局部看看。下图红框中的0.768是这个局部中最大的数字,它代表raft::LogManager::get_entry在等待涉及到bvar::detail::UniqueLockBase的函数上共等待了0.768秒(10秒内)。我们如果觉得这个时间不符合预期,就可以去排查代码。

![img](../images/raft_contention_2.png)
![img](/images/docs/raft_contention_2.png)

点击上方的count选择框,可以查看锁的竞争次数。选择后左上角变为了**Total samples: 439026**,代表采集时间内总共的锁竞争次数(估算)。图中箭头上的数字也相应地变为了次数,而不是时间。对比同一份结果的时间和次数,可以更深入地理解竞争状况。

![img](../images/raft_contention_3.png)
![img](/images/docs/raft_contention_3.png)
@@ -59,7 +59,7 @@ url加上?seconds=秒数,如/hotspots/cpu?seconds=5

cpu profiler的原理是在定期被调用的SIGPROF handler中采样所在线程的栈,由于handler(在linux 2.6后)会被随机地摆放于活跃线程的栈上运行,cpu profiler在运行一段时间后能以很大的概率采集到所有活跃线程中的活跃函数,最后根据栈代表的函数调用关系汇总为调用图,并把地址转换成符号,这就是我们看到的结果图了。采集频率由环境变量CPUPROFILE_FREQUENCY控制,默认100,即每秒钟100次或每10ms一次。在实践中cpu profiler对原程序的影响不明显。

![img](../images/echo_cpu_profiling.png)
![img](/images/docs/echo_cpu_profiling.png)

在Linux下,你也可以使用[pprof](https://github.com/brpc/brpc/blob/master/tools/pprof)或gperftools中的pprof进行profiling。

@@ -77,37 +77,37 @@ flagfile中可以使用`--flagfile包含另一个flagfile。`

为了防止误修改,需要动态修改的gflag必须有validator,显示此类gflag名字时有(R)后缀。

![img](../images/reloadable_flags.png)
![img](/images/docs/reloadable_flags.png)

*修改成功后会显示如下信息*

![img](../images/flag_setvalue.png)
![img](/images/docs/flag_setvalue.png)

*尝试修改不允许修改的gflag会显示如下错误信息*

![img](../images/set_flag_reject.png)
![img](/images/docs/set_flag_reject.png)

*设置一个不允许的值会显示如下错误(flag值不会变化)*

![img](../images/set_flag_invalid_value.png)
![img](/images/docs/set_flag_invalid_value.png)



r31658之后支持可视化地修改,在浏览器上访问时将看到(R)下多了下划线:

![img](../images/the_r_after_flag.png)
![img](/images/docs/the_r_after_flag.png)

点击后在一个独立页面可视化地修改对应的flag:

![img](../images/set_flag_with_form.png)
![img](/images/docs/set_flag_with_form.png)

填入true后确定:

![img](../images/set_flag_with_form_2.png)
![img](/images/docs/set_flag_with_form_2.png)

返回/flags可以看到对应的flag已经被修改了:

![img](../images/set_flag_with_form_3.png)
![img](/images/docs/set_flag_with_form_3.png)



@@ -43,13 +43,13 @@ WARNING: 12-26 10:01:25: * 0 [src/brpc/input_messenger.cpp:132][4294969345] Au

# 图示

![img](../images/heap_profiler_1.png)
![img](/images/docs/heap_profiler_1.png)

左上角是当前程序通过malloc分配的内存总量,顺着箭头上的数字可以看到内存来自哪些函数。

点击左上角的text选择框可以查看文本格式的结果,有时候这种按分配量排序的形式更方便。

![img](../images/heap_profiler_2.png)
![img](/images/docs/heap_profiler_2.png)

左上角的两个选择框作用分别是: