V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sbldehanhan
V2EX  ›  Python

gRPC 服务器对象创建,这句话怎么理解?

  •  
  •   sbldehanhan · 330 天前 · 898 次点击
    这是一个创建于 330 天前的主题,其中的信息可能已经有所发展或是发生改变。

    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) 意思是这个 server 可以并行处理 10 个客户端的调用?

    7 条回复    2023-05-30 10:34:26 +08:00
    LeegoYih
        1
    LeegoYih  
       330 天前
    ThreadPoolExecutor 这个是线程池吧,max_workers=10 表示最大 10 个线程数,不是指最大可并行处理的客户端数
    urnoob
        2
    urnoob  
       330 天前
    你要看底层是怎么使用这个池的,才知道的。
    sbldehanhan
        3
    sbldehanhan  
    OP
       330 天前
    @LeegoYih 对。是个线程池。最大线程数是否就是指可以并行处理的最多任务数?
    sbldehanhan
        4
    sbldehanhan  
    OP
       330 天前
    @urnoob 这是 google RPC 服务端的构造函数。源码没看懂,看看有没有大佬知道的。我根据上下文,是这样猜测的。
    julyclyde
        5
    julyclyde  
       326 天前
    @sbldehanhan 这个没太大必要去懂
    sbldehanhan
        6
    sbldehanhan  
    OP
       326 天前
    @julyclyde 其实我是想知道它支不支持多并发。
    julyclyde
        7
    julyclyde  
       325 天前
    @sbldehanhan 明确支持的,但是不是“10 个”,还有赖于具体的处理行为
    应该是不小于 10 个
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2791 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 13:59 · PVG 21:59 · LAX 06:59 · JFK 09:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.