Re: [I] 支持bRPC网关转发baidu协议请求的功能 (brpc)

2024-06-10 Thread via GitHub


chenBright commented on issue #2405:
URL: https://github.com/apache/brpc/issues/2405#issuecomment-2159708781

   稍微修改了一下原来的描述。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [I] 支持bRPC网关转发baidu协议请求的功能 (brpc)

2024-06-10 Thread via GitHub


chenBright commented on issue #2405:
URL: https://github.com/apache/brpc/issues/2405#issuecomment-2159705777

   嗯嗯,网关只转发baidu协议请求的话,是不需要json、pb互转的。
   
   
扩展一下,网关要支持多语言(php、nodejs、python等)接入baidu协议的brpc服务的话,client的payload一般使用json,网关负责服务发现和转发payload,brpc服务需要支持json、pb互转的能力。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [PR] Support proxy and generic call of baidu protocol (brpc)

2024-06-10 Thread via GitHub


chenBright commented on PR #2629:
URL: https://github.com/apache/brpc/pull/2629#issuecomment-2159676339

   done,rebase解决冲突。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [I] mbvar 如何通过 LatencyRecorder 获取平均耗时 (brpc)

2024-06-10 Thread via GitHub


renzhong commented on issue #2660:
URL: https://github.com/apache/brpc/issues/2660#issuecomment-2159668492

   我准备修复这个问题,有两个方案,一个是参考 bvar,拆分名字。一个是把平均耗时改成 
service_latency{valid="false",quantile='avg'} 0
   这两种方案,哪种更好一些? @wwbmmm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Oncall report from Jun 3rd to Jun 10th

2024-06-10 Thread Weibing Wang
Hi, all

During last week, 5 issues were closed, and the following 10 PRs were merged:

* fixbug: there is a ',' before 'quantile=' when labels is empty:
https://github.com/apache/brpc/pull/2659
* [feat] latency scale factor: https://github.com/apache/brpc/pull/2655
* Support thread local object iteration:
https://github.com/apache/brpc/pull/2632
* Fix max concurrency of thrift protocol and nshead protocol:
https://github.com/apache/brpc/pull/2613
* Support more meta for ServerNode: https://github.com/apache/brpc/pull/2603
* Reject http request without host: https://github.com/apache/brpc/pull/2600
* Support FastPthreadMutex contention profiler && expose
FastPthreadMutex to user: https://github.com/apache/brpc/pull/2589
* Fix invalid headers of multiple cookie and set-cookie:
https://github.com/apache/brpc/pull/2577
* EventDispatcher supports various IO types:
https://github.com/apache/brpc/pull/2560
* circuit breaker with half open state: https://github.com/apache/brpc/pull/2634

Best regards
Weibing Wang

-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [PR] Use butil::ThreadLocal to store keytable (brpc)

2024-06-10 Thread via GitHub


wwbmmm commented on PR #2645:
URL: https://github.com/apache/brpc/pull/2645#issuecomment-2157454749

   对这个场景有点疑问,如果bthread生命周期很短,为什么还要使用bthread_local变量呢,用pthread 
local、局部变量或者通过函数参数传递不行吗


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [PR] Use butil::ThreadLocal to store keytable (brpc)

2024-06-10 Thread via GitHub


wwbmmm commented on code in PR #2645:
URL: https://github.com/apache/brpc/pull/2645#discussion_r1632645911


##
src/bthread/key.cpp:
##
@@ -204,14 +205,57 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTable {
 SubKeyTable* _subs[KEY_1STLEVEL_SIZE];
 };
 
+class KeyTableList {
+public:
+KeyTableList() {
+keytable = NULL;
+}
+~KeyTableList() {
+bthread::TaskGroup* g = bthread::tls_task_group;
+bthread::KeyTable* old_kt = bthread::tls_bls.keytable;
+while (keytable) {
+bthread::KeyTable* kt = keytable;
+keytable = kt->next;
+bthread::tls_bls.keytable = kt;
+if (g) {
+g->current_task()->local_storage.keytable = kt;
+}
+delete kt;
+if (old_kt == kt) {
+old_kt = NULL;
+}
+g = bthread::tls_task_group;
+}
+bthread::tls_bls.keytable = old_kt;
+if(g) {
+g->current_task()->local_storage.keytable = old_kt;
+}
+}
+KeyTable* keytable;

Review Comment:
   class 类型不建议直接把成员暴露成public,要么改成struct,要么封装成getter/setter



##
src/bthread/key.cpp:
##
@@ -226,14 +270,16 @@ void return_keytable(bthread_keytable_pool_t* pool, 
KeyTable* kt) {
 delete kt;
 return;
 }
-std::unique_lock mu(pool->mutex);
+pthread_rwlock_rdlock(>rwlock);
 if (pool->destroyed) {
-mu.unlock();
+pthread_rwlock_unlock(>rwlock);
 delete kt;
 return;
 }
-kt->next = (KeyTable*)pool->free_keytables;
-pool->free_keytables = kt;
+auto list = (butil::ThreadLocal*)pool->list;

Review Comment:
   
全局free_keytables里的kt一旦被借走就永远还不回去free_keytables了吗?这样keytables的复用率会降低吧,如果线程数很多,可能会占用更多的内存



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



(brpc) branch master updated: fixbug: there is a ',' before 'quantile=' when labels is empty (#2659)

2024-06-10 Thread wwbmmm
This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new f8558b00 fixbug: there is a ',' before 'quantile=' when labels is 
empty (#2659)
f8558b00 is described below

commit f8558b008910711d46658f2a50d08a3b78e5cfc7
Author: renzhong zhang <107745...@qq.com>
AuthorDate: Mon Jun 10 14:15:58 2024 +0800

fixbug: there is a ',' before 'quantile=' when labels is empty (#2659)

Co-authored-by: Renzhong Zhang 
---
 src/bvar/multi_dimension_inl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bvar/multi_dimension_inl.h b/src/bvar/multi_dimension_inl.h
index 11b0bd5d..212f431b 100644
--- a/src/bvar/multi_dimension_inl.h
+++ b/src/bvar/multi_dimension_inl.h
@@ -372,7 +372,7 @@ void 
MultiDimension::make_labels_kvpair_string(std::ostream& os,
 comma[0] = ',';
 }
 if (quantile > 0) {
-os << ",quantile=\"" << quantile << "\"";
+os << comma << "quantile=\"" << quantile << "\"";
 }
 os << "}";
 }


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [PR] fixbug: there is a ',' before 'quantile=' when labels is empty (brpc)

2024-06-10 Thread via GitHub


wwbmmm merged PR #2659:
URL: https://github.com/apache/brpc/pull/2659


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



(brpc) branch master updated: [feat] latency scale factor (#2655)

2024-06-10 Thread wwbmmm
This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
 new 556e56b4 [feat] latency scale factor (#2655)
556e56b4 is described below

commit 556e56b409a19b272c2a11b037eb17be0cf461c9
Author: Alan Muhammad 
AuthorDate: Mon Jun 10 14:14:54 2024 +0800

[feat] latency scale factor (#2655)

* [feat] latency scale factor

* [fix] fix build

* [feat] define gflags in latency_recorder.cpp

-

Co-authored-by: lianxuechao 
---
 src/bvar/latency_recorder.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/bvar/latency_recorder.cpp b/src/bvar/latency_recorder.cpp
index c6532958..791bc626 100644
--- a/src/bvar/latency_recorder.cpp
+++ b/src/bvar/latency_recorder.cpp
@@ -280,7 +280,10 @@ void LatencyRecorder::hide() {
 _latency_percentiles.hide();
 }
 
+DEFINE_uint64(latency_scale_factor, 1, "latency scale factor, used by method 
status, etc., latency_us = latency * latency_scale_factor");
+
 LatencyRecorder& LatencyRecorder::operator<<(int64_t latency) {
+latency = latency / FLAGS_latency_scale_factor;
 _latency << latency;
 _max_latency << latency;
 _latency_percentile << latency;


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [PR] [feat] latency scale factor (brpc)

2024-06-10 Thread via GitHub


wwbmmm merged PR #2655:
URL: https://github.com/apache/brpc/pull/2655


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org



Re: [I] 如何在requestMeta当中设置 traceId, parentSpanId, spanId? (brpc)

2024-06-10 Thread via GitHub


wwbmmm commented on issue #2656:
URL: https://github.com/apache/brpc/issues/2656#issuecomment-2157374309

   brpc并没有暴露给用户修改RequestMeta中的traceid/spanid/parentspanid的方法,而且如你所说,brpc 
std协议中定义的这几个id都是long型,可能不能满足需求。
   但也可以考虑通过其它字段来传递这几个id。比如std协议在这个PR https://github.com/apache/brpc/pull/2406 
之后提供了自定义扩展字段,用户可以通过这种方式来传递这些id。或者使用其它协议比如http协议,用户可以通过请求的header来设置这些id。
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org