推荐学习书目
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 · May 25, 2023 · 1570 views
    This topic created in 1085 days ago, the information mentioned may be changed or developed.

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

    7 replies    2023-05-30 10:34:26 +08:00
    LeegoYih
        1
    LeegoYih  
       May 25, 2023
    ThreadPoolExecutor 这个是线程池吧,max_workers=10 表示最大 10 个线程数,不是指最大可并行处理的客户端数
    urnoob
        2
    urnoob  
       May 25, 2023
    你要看底层是怎么使用这个池的,才知道的。
    sbldehanhan
        3
    sbldehanhan  
    OP
       May 25, 2023
    @LeegoYih 对。是个线程池。最大线程数是否就是指可以并行处理的最多任务数?
    sbldehanhan
        4
    sbldehanhan  
    OP
       May 25, 2023
    @urnoob 这是 google RPC 服务端的构造函数。源码没看懂,看看有没有大佬知道的。我根据上下文,是这样猜测的。
    julyclyde
        5
    julyclyde  
       May 29, 2023
    @sbldehanhan 这个没太大必要去懂
    sbldehanhan
        6
    sbldehanhan  
    OP
       May 29, 2023
    @julyclyde 其实我是想知道它支不支持多并发。
    julyclyde
        7
    julyclyde  
       May 30, 2023
    @sbldehanhan 明确支持的,但是不是“10 个”,还有赖于具体的处理行为
    应该是不小于 10 个
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5590 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 08:43 · PVG 16:43 · LAX 01:43 · JFK 04:43
    ♥ Do have faith in what you're doing.