V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
dapengzhao
V2EX  ›  问与答

大佬们有没有 mongodb 写入优化的经验,目前 10 个线程 1 小时才写入 40 万条数据

  •  
  •   dapengzhao · Jul 12, 2019 · 1311 views
    This topic created in 2485 days ago, the information mentioned may be changed or developed.

    def insert_data(conn): while not traffic_queue.empty(): conn.xadz.insert_one(traffic_queue.get())

    这是写入函数,把处理好的数据放到了队列里面

    jifengg
        1
    jifengg  
       Jul 12, 2019
    mongodb 支持批量写入,不要一次一条写
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   925 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:22 · PVG 07:22 · LAX 16:22 · JFK 19:22
    ♥ Do have faith in what you're doing.