Skip to content

Commit

Permalink
align getting_started.md and thrift.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesge committed Aug 3, 2018
1 parent d2188ba commit 188fd03
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
16 changes: 8 additions & 8 deletions docs/cn/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will

To use brpc with glog, add `--with-glog`.

To enable thrift support, install thrift first and add `--with-thrift`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `--with-thrift`.

**Run example**

Expand Down Expand Up @@ -86,7 +86,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi

To use brpc with glog, add `-DWITH_GLOG=ON`.

To enable thrift support, install thrift first and add `-DWITH_THRIFT=ON`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `-DWITH_THRIFT=ON`.

**Run example with cmake**
```shell
Expand Down Expand Up @@ -147,7 +147,7 @@ To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will

To use brpc with glog, add `--with-glog`.

To enable thrift support, install thrift first and add `--with-thrift`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `--with-thrift`.

**Run example**

Expand Down Expand Up @@ -177,7 +177,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi

To use brpc with glog, add `-DWITH_GLOG=ON`.

To enable thrift support, install thrift first and add `-DWITH_THRIFT=ON`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `-DWITH_THRIFT=ON`.

**Run example**

Expand Down Expand Up @@ -227,7 +227,7 @@ To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will

To use brpc with glog, add `--with-glog`.

To enable thrift support, install thrift first and add `--with-thrift`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `--with-thrift`.

```shell
$ ls my_dev
Expand All @@ -251,7 +251,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi

To use brpc with glog, add `-DWITH_GLOG=ON`.

To enable thrift support, install thrift first and add `-DWITH_THRIFT=ON`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `-DWITH_THRIFT=ON`.

## MacOS

Expand Down Expand Up @@ -289,7 +289,7 @@ To not link debugging symbols, add `--nodebugsymbols` and compiled binaries will

To use brpc with glog, add `--with-glog`.

To enable thrift support, install thrift first and add `--with-thrift`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `--with-thrift`.

**Run example**

Expand Down Expand Up @@ -318,7 +318,7 @@ To not link debugging symbols, use `cmake -DWITH_DEBUG_SYMBOLS=OFF ..` and compi

To use brpc with glog, add `-DWITH_GLOG=ON`.

To enable thrift support, install thrift first and add `-DWITH_THRIFT=ON`.
To enable [thrift support](docs/en/thrift.md), install thrift first and add `-DWITH_THRIFT=ON`.

**Run example with cmake**
```shell
Expand Down
12 changes: 8 additions & 4 deletions docs/cn/thrift.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# 编译
为了复用解析代码,brpc对thrift的支持仍需要依赖thrift库以及thrift生成的代码,thrift格式怎么写,代码怎么生成,怎么编译等问题请参考thrift官方文档。

brpc默认不启用thrift支持也不需要thrift依赖。但如果需用thrift协议, 配置brpc环境的时候需加上--with-thrift参数.
brpc默认不启用thrift支持也不需要thrift依赖。但如果需用thrift协议, 配置brpc环境的时候需加上--with-thrift或-DWITH_THRIFT=ON.

Ubuntu环境下安装thrift依赖
Linux下安装thrift依赖
先参考[官方wiki](https://thrift.apache.org/docs/install/debian)安装好必备的依赖和工具,然后从[官网](https://thrift.apache.org/download)下载thrift源代码,解压编译。
```bash
wget http://www.us.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz
Expand All @@ -28,10 +28,14 @@ sudo make install

配置brpc支持thrift协议后make。编译完成后会生成libbrpc.a, 其中包含了支持thrift协议的扩展代码, 像正常使用brpc的代码一样链接即可。
```bash
# Ubuntu
sh config_brpc.sh --headers=/usr/include --libs=/usr/lib --with-thrift
#或者使用cmake
# Fedora/CentOS
sh config_brpc.sh --headers=/usr/include --libs=/usr/lib64 --with-thrift
# Or use cmake
mkdir build && cd build && cmake ../ -DWITH_THRIFT=1
```
更多编译选项请阅读[Getting Started](docs/cn/getting_started.md)

# Client端访问thrift server
基本步骤:
Expand Down Expand Up @@ -139,4 +143,4 @@ brpc thrift | 60 | 19.5w | 0.3ms | 22%
框架 | 线程数 | QPS | 平响 | cpu利用率
---- | --- | --- | --- | ---
native thrift | 60 | 1.7w | 3.5ms | 76%
brpc thrift | 60 | 2.1w | 2.9ms | 93%
brpc thrift | 60 | 2.1w | 2.9ms | 93%
16 changes: 10 additions & 6 deletions docs/en/thrift.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Advantages compared to the official solution:
- Better performance.

# Compile
brpc depends on the thrift lib and the code generated by thrift tools to reuse the parsing code. Please read official documents to find out how to write thrift files, generate code, compilations etc.
brpc depends on the thrift library and reuses some code generated by thrift tools. Please read official documents to find out how to write thrift files, generate code, compilations etc.

brpc does not enable thrift support or depend on the thrift lib by default. If the thrift support is needed, config brpc with extra --with-thrift.
brpc does not enable thrift support or depend on the thrift lib by default. If the support is needed, compile brpc with extra --with-thrift or -DWITH_THRIFT=ON

Install thrift under Ubuntu
Install thrift under Linux
Read [Official wiki](https://thrift.apache.org/docs/install/debian) to install depended libs and tools, then download thrift source code from [official site](https://thrift.apache.org/download), uncompress and compile。
```bash
wget http://www.us.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz
Expand All @@ -28,10 +28,14 @@ sudo make install

Config brpc with thrift support, then make. The compiled libbrpc.a includes extended code for thrift support and can be linked normally as in other brpc projects.
```bash
# Ubuntu
sh config_brpc.sh --headers=/usr/include --libs=/usr/lib --with-thrift
#or use cmake
mkdir build && cd build && cmake ../ -DWITH_THRIFT=1
# Fedora/CentOS
sh config_brpc.sh --headers=/usr/include --libs=/usr/lib64 --with-thrift
# Or use cmake
mkdir build && cd build && cmake ../ -DWITH_THRIFT=ON
```
Read [Getting Started](docs/cn/getting_started.md) for more compilation options.

# Client accesses thrift server
Steps:
Expand Down Expand Up @@ -138,4 +142,4 @@ brpc thrift | 60 | 19.5w | 0.3ms | 22%
Framework | Threads Num | QPS | Avg lantecy | CPU
---- | --- | --- | --- | ---
native thrift | 60 | 1.7w | 3.5ms | 76%
brpc thrift | 60 | 2.1w | 2.9ms | 93%
brpc thrift | 60 | 2.1w | 2.9ms | 93%

0 comments on commit 188fd03

Please sign in to comment.