GithubHelp home page GithubHelp logo

建议增加mongodb连接池 about funboost HOT 8 CLOSED

sun1613 avatar sun1613 commented on May 26, 2024
建议增加mongodb连接池

from funboost.

Comments (8)

ydf0509 avatar ydf0509 commented on May 26, 2024

pymongo MongoClient是自身就有连接池的,默认就是100.(每个进程会生成各自的mongo连接池)

      - `maxPoolSize` (optional): The maximum allowable number of
        concurrent connections to each connected server. Requests to a
        server will block if there are `maxPoolSize` outstanding
        connections to the requested server. Defaults to 100. Can be
        either 0 or None, in which case there is no limit on the number
        of concurrent connections.
      - `minPoolSize` (optional): The minimum required number of concurrent
        connections that the pool will maintain to each connected server.
        Default is 0.
      - `maxIdleTimeMS` (optional): The maximum number of milliseconds that
        a connection can remain idle in the pool before being removed and
        replaced. Defaults to `None` (no limit).

进程也是可以设置自动重启的,不依赖亲自手动重启。

from funboost.

ydf0509 avatar ydf0509 commented on May 26, 2024

你使用mongo做消息队列还是存储消费状态,目前。可以发下你的boost装饰器看看,然后发一下启动函数消费的代码截图看看

from funboost.

ydf0509 avatar ydf0509 commented on May 26, 2024

建议使用猴子补丁来替换funboost的mongo类就好了。 这种关于最中间件连接池配置的不暴露在funboost_config.py 中,用户想修改,使用猴子补丁方式动态替换连接到自己的类即可。

from funboost.

sun1613 avatar sun1613 commented on May 26, 2024

是用来存储消费状态的,那我试下用猴子补丁来替换试试,感谢作者

from funboost.

ydf0509 avatar ydf0509 commented on May 26, 2024

建议先升级到19.7,再打猴子补丁,19.7 mongo 做了一次变化。

from funboost.

ydf0509 avatar ydf0509 commented on May 26, 2024

你的类 (Your定义的MongoMixin) 实例化pymongo你写成 pymongo.MongoClient(funboost_config_deafult.MONGO_CONNECT_URL,
connect=False,maxIdleTimeMS=60*1000,minPoolSize=3,maxPoolSize=20)

from funboost.utils import mongo_util
mongo_util.MongoMixin = Your定义的MongoMixin

from funboost.

sun1613 avatar sun1613 commented on May 26, 2024

好的好的😊

from funboost.

sun1613 avatar sun1613 commented on May 26, 2024

进程设置自动重启这个是在哪里配置的,我看了文档也没有相关参数配置

from funboost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.