drlhsfqoa350437979 2011-12-13 20:48
浏览 114
已采纳

MongoDB限制了并发量

I am creating an application that has several servers running at the same time and several process on each server all of those are processing data making query/updates and inserts. So a total of 35+ concurrent connections are being made at all times. These servers are all processing data that is being sent to a single mongodb server (mongod). I am not sharding my database at the moment. The problem is that I am being limited by my mongodb server. Whenever I add more servers the queries/updates/inserts are running slower (they take more time). I was running this mongohq.com, then I just recently created my own amazon server for mongod but I am still getting nearly the same result. List below is my db.serverStatus({}). I am somewhat new to mongodb but basically I need to know how to speed up the process for the amount of concurrent operations going on with my mongo server. I need it to be able to handle a lot of requests. I know sharding is a possible way around this but if it is at all possible can you list some other solutions available. Thanks.

> db.serverStatus({})
{
"host" : "ip-10-108-245-21:28282",
"version" : "2.0.1",
"process" : "mongod",
"uptime" : 11380,
"uptimeEstimate" : 11403,
"localTime" : ISODate("2011-12-13T22:27:56.865Z"),
"globalLock" : {
    "totalTime" : 11380429167,
    "lockTime" : 86138670,
    "ratio" : 0.007569017717695356,
    "currentQueue" : {
        "total" : 0,
        "readers" : 0,
        "writers" : 0
    },
    "activeClients" : {
        "total" : 35,
        "readers" : 35,
        "writers" : 0
    }
},
"mem" : {
    "bits" : 64,
    "resident" : 731,
    "virtual" : 6326,
    "supported" : true,
    "mapped" : 976,
    "mappedWithJournal" : 1952
},
"connections" : {
    "current" : 105,
    "available" : 714
},
"extra_info" : {
    "note" : "fields vary by platform",
    "heap_usage_bytes" : 398656,
    "page_faults" : 1
},
"indexCounters" : {
    "btree" : {
        "accesses" : 798,
        "hits" : 798,
        "misses" : 0,
        "resets" : 0,
        "missRatio" : 0
    }
},
"backgroundFlushing" : {
    "flushes" : 189,
    "total_ms" : 29775,
    "average_ms" : 157.53968253968253,
    "last_ms" : 185,
    "last_finished" : ISODate("2011-12-13T22:27:16.651Z")
},
"cursors" : {
    "totalOpen" : 34,
    "clientCursors_size" : 34,
    "timedOut" : 0,
    "totalNoTimeout" : 34
},
"network" : {
    "bytesIn" : 89743967,
    "bytesOut" : 59379407,
    "numRequests" : 840133
},
"opcounters" : {
    "insert" : 5437,
    "query" : 8957,
    "update" : 4312,
    "delete" : 0,
    "getmore" : 76,
    "command" : 821388
},
"asserts" : {
    "regular" : 0,
    "warning" : 0,
    "msg" : 0,
    "user" : 0,
    "rollovers" : 0
},
"writeBacksQueued" : false,
"dur" : {
    "commits" : 29,
    "journaledMB" : 0.147456,
    "writeToDataFilesMB" : 0.230233,
    "compression" : 0.9999932183619632,
    "commitsInWriteLock" : 0,
    "earlyCommits" : 0,
    "timeMs" : {
        "dt" : 3031,
        "prepLogBuffer" : 0,
        "writeToJournal" : 29,
        "writeToDataFiles" : 2,
        "remapPrivateView" : 0
    }
},
"ok" : 1

}

  • 写回答

1条回答 默认 最新

  • dopgl80062 2011-12-14 12:12
    关注

    What is surprising about more load generating higher response times from mongod? There are a few possible reasons for degradation of performance.

    For example, every write to mongod uses a process wide write lock. So the more servers you add the more updates will be attempted (assuming update load is about stable per server) and thus the longer the process will spend in write lock. You can keep an eye on this through mongostat's "locked %" field.

    Additionally if you use JS powered functionality (m/r, db.eval(), etc.) these operations cannot be executed concurrently by mongod due to the fact that each mongod has a single JavaScript context (which is single threaded).

    If you want a more specific analysis then you might want to consider posting exact numbers. How many reads and writes per second, what are the query plans for the queries you execute, what effect does adding an additional app server have on your overall database performance, etc.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?