Skip to content

Commit

Permalink
Release/v0.0.8 (#195)
Browse files Browse the repository at this point in the history
* ci: remove gofmt, better error reporting on gofumpt check

* docs: add use guide for Connection Multiplexing (#163)

* Update issue templates

* perf: improve memory reusage (#166)

* docs: redirect to kitex-benchmark in readme (#172)

* fix: netpollmux shard index overflow

* fix: remove reflection of option arguments to prevent data-race (#180)

* feat: pass thrift plugin arguments (#175)

* feat: fill ttheader basic from_info to output from_info when decode error happen (#184)

* fix: rpc finished error may happen small probability in failure retry scenario && add sample check for retry circuit breaking (#181)

* fix: failure retry rpc finished error

* feat: shard rings

* fix: test case mistake (#185)

* chore(deps): bump github.com/tidwall/gjson from 1.8.0 to 1.9.3

Bumps [github.com/tidwall/gjson](https://github.com/tidwall/gjson) from 1.8.0 to 1.9.3.
- [Release notes](https://github.com/tidwall/gjson/releases)
- [Commits](tidwall/gjson@v1.8.0...v1.9.3)

---
updated-dependencies:
- dependency-name: github.com/tidwall/gjson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* mod: unlink UDS in CreateListener

* ConnPool.Get() return a conn, maybe short conn, not always long conn (#190)

* use sync.RWMutex is better (#186)

* chore: update version to v0.0.8

Change-Id: I1fd2e0215920dfce79677fbfd41b377c84826036

Co-authored-by: kevin <[email protected]>
Co-authored-by: Guangming Luo <[email protected]>
Co-authored-by: YangruiEmma <[email protected]>
Co-authored-by: lsjbd <[email protected]>
Co-authored-by: QihengZhou <[email protected]>
Co-authored-by: Joway <[email protected]>
Co-authored-by: Simon Wang <[email protected]>
Co-authored-by: Hchen <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Z.Q.K <[email protected]>
Co-authored-by: halst <[email protected]>
  • Loading branch information
12 people authored Nov 5, 2021
1 parent b804b15 commit 5c6e40c
Show file tree
Hide file tree
Showing 47 changed files with 614 additions and 357 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
3 changes: 1 addition & 2 deletions .github/workflows/push-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ jobs:
- name: Lint
run: |
test -z "$(gofmt -s -l .)"
go vet -stdmethods=false $(go list ./...)
go install mvdan.cc/gofumpt@latest
test -z "$(gofumpt -s -l .)"
test -z "$(gofumpt -s -l -extra .)" || echo "Please run 'gofumpt -l -w -extra .'"
- name: Unit Test
run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
27 changes: 2 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,9 @@ Kitex has built-in code generation tools that support generating **Thrift**, **P

## Performance

We compared the performance of Kitex with some popular RPC frameworks ([benchmark](https://github.com/cloudwego/kitex-benchmark)), such as [gRPC](https://github.com/grpc/grpc) and [RPCX](https://github.com/smallnest/rpcx), both using Protobuf. The test results show that [Kitex](https://github.com/cloudwego/kitex) performs better.
Performance benchmark can only provide limited reference. In production, there are many factors can affect actual performance.

*Note: The performance benchmarks obtained from the experiment are for reference only, because there are many factors that can affect the actual performance in application scenarios.*

### Test Environment

- CPU: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 4 cores
- Memory: 8GB
- OS: Debian 5.4.56.bsk.1-amd64 x86_64 GNU/Linux
- Go: 1.15.4

### Concurrency Performance

Change the concurrency with a fixed packet size 1KB.

QPS|TP99|TP999
----|----|----
| ![image](docs/images/performance_concurrent_qps.png) | ![image](docs/images/performance_concurrent_tp99.png) | ![image](docs/images/performance_concurrent_tp999.png) |

### Throughput Performance

Change packet size with a fixed concurrency of 100.

QPS|TP99|TP999
----|----|----
|![image](docs/images/performance_bodysize_qps.png) | ![image](docs/images/performance_bodysize_tp99.png) | ![image](docs/images/performance_bodysize_tp999.png) |
We provide the [kitex-benchmark](https://github.com/cloudwego/kitex-benchmark) project to track and compare the performance of Kitex and other frameworks under different conditions for reference.

## Related Projects

Expand Down
23 changes: 1 addition & 22 deletions README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,7 @@ Kitex[kaɪt'eks] 字节跳动内部的 Golang 微服务 RPC 框架,具有**高

性能测试只能提供相对参考,工业场景下,有诸多因素可以影响实际的性能表现。

由于开源社区缺少支持 Thrift 的优秀 RPC 框架,当前对比项目为 [gRPC](https://github.com/grpc/grpc)[RPCX](https://github.com/smallnest/rpcx),均使用 Protobuf 。

我们通过 [测试代码](https://github.com/cloudwego/kitex-benchmark) 比较了它们的性能,测试表明 [Kitex](https://github.com/cloudwego/kitex) 具有明显优势。

### 测试环境

* CPU: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 4 cores
* Memory: 8GB
* OS: Debian 5.4.56.bsk.1-amd64 x86_64 GNU/Linux
* Go: 1.15.4

### 并发表现 (Echo 1KB, 改变并发量)

| QPS | TP99 | TP999 |
| :--------------------------------------------------- | :---------------------------------------------------: | :----------------------------------------------------: |
| ![image](docs/images/performance_concurrent_qps.png) | ![image](docs/images/performance_concurrent_tp99.png) | ![image](docs/images/performance_concurrent_tp999.png) |

### 吞吐表现 (并发 100, 改变包大小)

| QPS | TP99 | TP999 |
| :------------------------------------------------- | :-------------------------------------------------: | :--------------------------------------------------: |
| ![image](docs/images/performance_bodysize_qps.png) | ![image](docs/images/performance_bodysize_tp99.png) | ![image](docs/images/performance_bodysize_tp999.png) |
我们提供了 [kitex-benchmark](https://github.com/cloudwego/kitex-benchmark) 项目用来长期追踪和比较 Kitex 与其他框架在不同情况下的性能数据以供参考。

## 相关项目

Expand Down
8 changes: 2 additions & 6 deletions client/callopt/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,11 @@ func newOptions() interface{} {
}
}

func (co *callOptions) zero() {
// Recycle zeros the call option and put it to the pool.
func (co *callOptions) Recycle() {
co.configs = nil
co.svr = nil
co.locks.Zero()
}

// Recycle zeros the call option and put it to the pool.
func (co *callOptions) Recycle() {
co.zero()
callOptionsPool.Put(co)
}

Expand Down
5 changes: 3 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ func (kc *kClient) invokeHandleEndpoint() (endpoint.Endpoint, error) {
return
}
config := ri.Config()
if kc.svcInfo.MethodInfo(methodName).OneWay() {
m := kc.svcInfo.MethodInfo(methodName)
if m.OneWay() {
sendMsg = remote.NewMessage(req, kc.svcInfo, ri, remote.Oneway, remote.Client)
} else {
sendMsg = remote.NewMessage(req, kc.svcInfo, ri, remote.Call, remote.Client)
Expand All @@ -347,7 +348,7 @@ func (kc *kClient) invokeHandleEndpoint() (endpoint.Endpoint, error) {
if err = cli.Send(ctx, ri, sendMsg); err != nil {
return
}
if resp == nil || kc.svcInfo.MethodInfo(methodName).OneWay() {
if resp == nil || m.OneWay() {
cli.Recv(ctx, ri, nil)
return nil
}
Expand Down
4 changes: 1 addition & 3 deletions client/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ func WithLongConnection(cfg connpool.IdleConfig) Option {
}

// WithMuxConnection specifies the transport type to be mux.
// IMPORTANT: this option is not stable, and will be changed or removed in the future!!!
// We don't promise compatibility for this option in future versions!!!
func WithMuxConnection(connNum int) Option {
return Option{F: func(o *client.Options, di *utils.Slice) {
di.Push("WithMuxConnection")
Expand Down Expand Up @@ -365,7 +363,7 @@ func WithBackupRequest(p *retry.BackupPolicy) Option {
// WithCircuitBreaker adds a circuitbreaker suite for the client.
func WithCircuitBreaker(s *circuitbreak.CBSuite) Option {
return Option{F: func(o *client.Options, di *utils.Slice) {
di.Push(fmt.Sprintf("WithCircuitBreaker(%+v)", s))
di.Push("WithCircuitBreaker()")
o.CBSuite = s
}}
}
35 changes: 21 additions & 14 deletions client/rpctimeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,17 @@ import (
"github.com/cloudwego/kitex/pkg/rpctimeout"
)

func recoverFunc(ctx context.Context, logger klog.FormatLogger, ri rpcinfo.RPCInfo, done chan error) {
if err := recover(); err != nil {
e := fmt.Errorf("KITEX: panic, remote[to_service=%s|method=%s], err=%v\n%s",
ri.To().ServiceName(), ri.To().Method(), err, debug.Stack())
if l, ok := logger.(klog.CtxLogger); ok {
l.CtxErrorf(ctx, "%s", e.Error())
} else {
logger.Errorf("%s", e.Error())
}
rpcStats := rpcinfo.AsMutableRPCStats(ri.Stats())
rpcStats.SetPanicked(err)
done <- e
func panicToErr(ctx context.Context, panicInfo interface{}, ri rpcinfo.RPCInfo, logger klog.FormatLogger) error {
e := fmt.Errorf("KITEX: panic, remote[to_service=%s|method=%s], err=%v\n%s",
ri.To().ServiceName(), ri.To().Method(), panicInfo, debug.Stack())
if l, ok := logger.(klog.CtxLogger); ok {
l.CtxErrorf(ctx, "%s", e.Error())
} else {
logger.Errorf("%s", e.Error())
}
close(done)
rpcStats := rpcinfo.AsMutableRPCStats(ri.Stats())
rpcStats.SetPanicked(e)
return e
}

func makeTimeoutErr(ctx context.Context, start time.Time, timeout time.Duration) error {
Expand Down Expand Up @@ -94,7 +91,17 @@ func rpcTimeoutMW(mwCtx context.Context) endpoint.Middleware {

done := make(chan error, 1)
gofunc.GoFunc(ctx, func() {
defer recoverFunc(ctx, logger, ri, done)
defer func() {
if panicInfo := recover(); panicInfo != nil {
e := panicToErr(ctx, panicInfo, ri, logger)
done <- e
}
if !errors.Is(err, kerrors.ErrRPCFinish) {
// Don't regards ErrRPCFinish as normal error, it happens in retry scene,
// ErrRPCFinish means previous call returns first but is decoding.
close(done)
}
}()
err = next(ctx, request, response)
if err != nil && ctx.Err() != nil && !errors.Is(err, kerrors.ErrRPCFinish) {
// error occurs after the wait goroutine returns,
Expand Down
67 changes: 0 additions & 67 deletions docs/guide/basic-features/connection_pool.md

This file was deleted.

Loading

0 comments on commit 5c6e40c

Please sign in to comment.