Skip to content

同一个进程中存在Server和Client共存时,线程并发问题 #2971

@Karssadin

Description

@Karssadin
  • 文档中有提到Server构建时的options.num_threads是同一个进程内Server和Client共享的线程数量。
你不能认为Server就用了这么多线程,因为进程内的所有Server和Channel会共享线程资源,线程总数是所有ServerOptions.num_threads和-bthread_concurrency中的最大值。比如一个程序内有两个Server,num_threads分别为24和36,bthread_concurrency为16。那么worker线程数为max(24, 36, 16) = 36。这不同于其他RPC实现中往往是加起来。
  • 并且有如下描述
当前server达到最大并发并不意味着集群中的其他server也达到最大并发了,立刻让client获知错误,并去尝试另一台server在全局角度是更好的策略。
  • 在接收方接收到请求之后发现达到最大并发时会返回错误码,那如果是Client在调用发送时达到最大并发的话会是什么情况?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions