PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 9th of December, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:01:06] <lkannan> So rebuilt index for that collection, some changes in the index count: https://gist.github.com/lakshmi-kannan/31bb4e45865d5448d27b. Mongo still at 100%.
[00:04:08] <GothAlice> lkannan: Hmm. Would you be willing to PM me your process strace? I might remember enough 2.4 internals to make sense of it.
[00:04:29] <lkannan> Absolutely.
[00:04:36] <GothAlice> Changes in index count are… not a good sign, really. ;)
[00:05:59] <GothAlice> If you were using 2.6+ with sharding enabled, though, certain index record counts may be kinda somewhat sorta inaccurate. (Because the shards report back "index buckets", not record counts.)
[00:06:06] <GothAlice> But, not so much the case here.
[00:07:02] <GothAlice> BSD sample is so nice. Keep forgetting that sample/spindump aren't GNU tools. XP
[00:09:10] <GothAlice> lkannan: Some of those index size drops are substantial. Unless those indexes were created with "background: true", that's worrying to me.
[00:09:28] <GothAlice> The _id_ index differing would indicate to me a full repair may be necessary. :|
[00:09:55] <GothAlice> cheeser: Ever seen a drop like that on _id_ indexes after a reIndex()?
[00:09:57] <lkannan> I see. Sorry, was getting strace info to you.
[00:10:18] <cheeser> never looked
[00:10:20] <GothAlice> lkannan: No worries. I problem solve "out loud". Take your time. :)
[00:14:48] <GothAlice> Ugh. And I keep forgetting how noisy Linux syscalls are. XP
[00:18:04] <GothAlice> lkannan: Looks like a large chunk of that trace is something, somewhere requesting MongoDB server stats. The many, many futex (fast userspace mutex) lock fails with "EAGAIN (Resource temporarily unavailable)" may be concerning.
[00:18:59] <lkannan> I was thinking the same. But the PID is not mongo PID.
[00:19:28] <lkannan> ps auxww | grep didn't match that pid.
[00:19:42] <GothAlice> Ah, then that'd be a thread.
[00:19:49] <lkannan> Plausible.
[00:19:54] <GothAlice> (Or transitory.)
[00:20:06] <lkannan> ^ Leaning towards this because different PID.
[00:20:50] <GothAlice> However, a failure to acquire locks in reasonable time frames would go a long way towards explaining the slowdown.
[00:21:34] <GothAlice> As an off question: what filesystem are your stripes on?
[00:21:37] <lkannan> Slowness is one thing. What's eating up the CPU?
[00:21:55] <lkannan> EBS I think.
[00:21:56] <GothAlice> That may be caused by a busy loop around those locks. socket.recv is a common culprit, too.
[00:22:07] <GothAlice> lkannan: Nono, what filesystem format? ;P
[00:22:18] <GothAlice> ext3/4, reiser, btrfs, …
[00:24:41] <lkannan> ext4.
[00:24:41] <lkannan> TIL.
[00:25:19] <lkannan> Jesus. Mongo is spinning even without app doing much. I have debug logs turned on for our app and trust me we have so.much.logging.
[00:28:02] <GothAlice> I'd seriously check the underlying storage for problems. Grab a copy of 'htop' and enable "Detailed CPU time" — is it waiting on system, user, or io?
[00:28:35] <lkannan> Will do.
[00:29:20] <GothAlice> Additionally: always good to have backups, as a full repair may be needed. I'd recommend stopping the DB for enough time to snapshot the stripes, make a local copy of the stripes, and try to repair them locally.
[00:30:23] <lkannan> Makes sense.
[00:30:34] <GothAlice> cheeser: You know you mongo too much when you can read BSON. As a binary.
[00:32:11] <GothAlice> Heh, and if you're making a local copy, I'd also try to reproduce the failure locally, too. Either you can or can't… either way the result is significant. :)
[00:32:44] <GothAlice> (If you can't, it may be the machine. If you can, it's surely the data.)
[00:40:39] <lkannan> GothAlice: Some news. I turned on mongo debug logging and still was seeing only trace_d_b queries I pointed you to earlier. We made a call to drop trace_d_b and we did :). #yolo. Mongo CPU dropped significantly.
[00:41:12] <GothAlice> Hmm.
[00:42:23] <lkannan> Definitely points to some problem with how we are writing to that collection. I am going to try a 2.6 upgrade and see if this problem comes back.
[00:42:47] <lkannan> Appreciate all the help.
[00:43:25] <GothAlice> I'd carefully review the indexes you use by testing small scale in development with dex on, using "normal" behaviour on the app.
[00:43:57] <GothAlice> And remember: MongoDB documents do have size limits; you can't append values to one forever. You may need to add bounds checking for that.
[00:44:48] <lkannan> Got it. So "totalIndexSize" : 8176 -> Is this bytes or count?
[00:45:29] <lkannan> apparently bytes.
[00:47:09] <cheeser> GothAlice: heh
[00:48:26] <jiffe> if a value is quoted in db.coll.find() output that means it is a string?
[00:48:49] <jiffe> I have perl inserting into a collection via $mongo_records->insert( $ref, { safe => 1 } );, Dumper($ref) shows time_stamp to be an integer but it is quoted in the mongodb output
[00:49:08] <GothAlice> lkannan: Indeed, bytes.
[00:50:40] <GothAlice> lkannan: Reindexing "compacts" the indexes. Substantial drops like those are… weird to my brain. Possibly explained if the index was created in the background because those are created "sparsely" on-disk, though, but _id_ is not that way unless there's some manipulation going on.
[00:57:10] <sector_0> how can I get a simple mongodb server up and running?
[00:57:51] <sector_0> and before someone tells me to sign up for the courses...I have but they havne't started yet but I need to test some code
[00:58:46] <Boomtime> hi sector_0
[00:58:54] <sector_0> hello
[00:59:02] <Boomtime> download it, perhaps from here; https://www.mongodb.org/downloads#production
[00:59:07] <Boomtime> run it
[00:59:13] <lkannan> GothAlice: Just read through our code and we don't do background indexing. Currently reading through the code for updating trace collection. I'll keep you posted.
[00:59:18] <Boomtime> use the mongo shell to connect to it
[00:59:28] <Boomtime> everything else you can learn from the docs if you need
[00:59:42] <Boomtime> and the university course is well recommended, it's a great intro
[01:01:09] <sector_0> Boomtime, yeah I signed up, but it starts in January
[01:04:30] <sector_0> I'm trying to start mongo using "sudo service mongod start"
[01:05:05] <sector_0> "mongod start/running, process 7283" gets printed after but then if I do "ps -A | grep mongo"
[01:05:11] <sector_0> the process isn't there
[01:05:22] <sector_0> and I can't connect to it using the mongo shell
[01:10:26] <Boomtime> to run it as a service may require additional setup, such as configuration file
[01:10:56] <Boomtime> try following the appropriate setup guide: https://docs.mongodb.org/manual/administration/install-on-linux/
[01:13:32] <sector_0> that is what I followed
[01:13:42] <sector_0> the setup for ubuntu 14.04 to be specific
[01:14:05] <sector_0> the first couple times I tried it, it worked but now it just refuses to start
[01:45:33] <mylord> how can i update records to be [{p1:{p1,p2}}] instead of just [{p1,p2}]
[01:45:59] <mylord> ie, move/copy the object to be under an ID
[01:46:27] <mylord> something like db.items.update({}, {$set:{assetid:this}}, {multi:true})
[01:47:07] <mylord> where “this” is the entire record
[01:53:48] <mylord> anyone alive?
[01:58:37] <idd2d> When (if ever) should I use a join table in mongo? I've got a many-to-many (even squillions-to-squillions, depending on your definition) relationship going on, and I'm wondering which approach to this relationship is most performant.
[02:11:36] <Boomtime> sector_0: what does the log say?
[02:14:23] <sector_0> Boomtime, Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
[02:14:30] <sector_0> Fatal Assertion 28578
[02:14:38] <sector_0> that's the last 2 lines
[02:15:13] <sector_0> the rest look rather normal to me, just couple general info about the current mongo setup
[02:19:47] <boutell> I noticed that mongolab offers dedicated single-node plans, which are among its priciest. I am scratching my head at that. Why would you want a single-node mongodb hosting plan? I mean, for projects that aren’t webscale, which is most projects, we run mongodb in a single node configuration quite often, and just do nightly mongodumps. But if you were paying someone else for your mongo, wouldn’t you want a replica set?
[02:20:26] <cheeser> if i was running a production app, i'd want a replica set regardless.
[02:22:21] <boutell> I can see why you’d do that
[02:24:33] <boutell> this is weird:
[02:24:35] <boutell> “The deployment of a replica set affects the outcome of failover situations. To support effective failover, ensure that one facility can elect a primary if needed. Choose the facility that hosts the core application systems to host the majority of the replica set. Place a majority of voting members and all the members that can become primary in this facility. Otherwise, network partitions could prevent the set from being able
[02:24:35] <boutell> form a majority.”
[02:25:05] <boutell> sooooo if you have two nodes in location A and one node in location B, and location A is underwater, does the node in location B just say “oh well” because it’s not a majority?
[02:25:17] <cheeser> potentially, yep
[02:25:29] <boutell> interesting. But I guess you could manually intervene at that point.
[02:25:34] <cheeser> you don't want to have the split brain problem.
[02:25:37] <boutell> right
[02:25:45] <boutell> when they both are up but the network is not
[02:25:53] <cheeser> right. and you'd want to. at worst your app would go in to read only mode.
[02:25:58] <boutell> yeah
[02:26:07] <boutell> which is pretty okay for that kind of degree of disaster
[02:26:28] <cheeser> unless you can afford 3 DCs ;)
[02:26:48] <boutell> cheeser: because the surviving two would have a majority?
[02:26:53] <cheeser> yep
[02:27:08] <boutell> I gotcha
[02:28:07] <boutell> I was interested to see that straight master-slave is actually a thing in mongo, but it seems to be discouraged. I would think that for a certain set of needs (and a certain budget), it’s one of the reasonable choices
[02:28:38] <cheeser> master-slave is eons outdated
[02:28:54] <boutell> it’s certainly not the answer if you can afford three DCs (:
[02:28:54] <cheeser> no reason not to use a replica set
[02:29:59] <boutell> [read read read] I guess having two nodes is actually allowed, and you can forbid one of them from becoming the primary (without intervention)
[02:30:03] <boutell> two nodes in a replica set, that is
[02:30:18] <cheeser> you can use an arbiter, too
[02:33:00] <boutell> interesting
[02:33:47] <boutell> is it possible to forbid reads from the secondary if the primary is reachable? I’m struggling with an application that needs consistent read-after-write semantics. That may just not be something mongo really wants to give me, and gives me by accident in a single node configuration.
[02:37:53] <cheeser> use a read preference of PrimaryPreferred
[02:38:45] <boutell> that makes sense
[03:03:34] <boutell> . o O so a 2-node replica set with the write preference set to PrimaryPreferred and the primary status disabled for the secondary gives me a reasonable setup for streaming backup to a geographically redundant server that is only going to get seriously lit up by a DNS cutover in the event of ragnarok
[03:04:23] <boutell> . o O both run on sizable VPSes that also host the web application because small budget, and VPSes have high durability generally in terms of not being easily wiped out by the death of two hard drives
[03:27:54] <sector_0> Boomtime, I restarted and now it's working
[03:28:05] <sector_0> but what caused that little glitch just now?
[08:23:16] <newbsduser> i modified and compiled mongodb for increasing 16MB max bson object size to 64 MB... But now java clients gives me this error message: WARN PlanBasedMongoClient - Mongo max bson object size invalid; waiting... how can I solve it?
[08:26:03] <Zelest> sorry for asking, but why on earth do you need 64MB documents? :o
[08:31:33] <newbsduser> Zelest, iam trying to insert tcp/udp sessions
[08:31:38] <newbsduser> for each ip address
[08:31:53] <newbsduser> on a huge traffic
[08:32:28] <Zelest> but why not use multiple documents rather than one huge document?
[08:45:17] <newbsduser> Zelest, actually it s multipe documents
[08:45:18] <newbsduser> :D
[09:49:55] <vasilakisfil> Hi! I am trying to connect to my staging mongodb using mongoid but I get: Mongo::Error::NoServerAvailable: No server is available matching preference. However I am able to connect to it using the cli tool mongo
[09:49:59] <vasilakisfil> what could I do wrong ?
[11:05:48] <contracode> does anyone have experience with MongoDB and PHP?
[11:16:17] <contracode> good morning, Derick! I'm looking at legacy code, and I see this in PHP --> $mongo_con = new Mongo(); $m_db = $mongo_con->foo;
[11:17:13] <contracode> I haven't used PHP in years, and I'm new to MongoDB-- but would that select the MongoDB "foo" table? It's odd syntax, in my opinion
[11:25:53] <StephenLynx> collection.
[11:25:54] <StephenLynx> not table
[11:26:38] <Derick> correct
[11:26:51] <StephenLynx> and that line is doing two things.
[11:26:58] <Derick> odd syntax, and that's why it's gone in the new driver
[11:27:03] <Derick> StephenLynx: two?
[11:27:14] <StephenLynx> first it is opening a connection to the db and then is getting a reference to the collection
[11:27:32] <Derick> StephenLynx: nope, it does not create a connection. Connections are created when queries are run
[11:27:48] <StephenLynx> hm
[11:28:05] <StephenLynx> and btw, I think it is getting a reference to the db and not the collection
[11:28:21] <Derick> that is correct
[11:28:46] <Derick> contracode: you can also do $m_db = $mongo_con->selectDatabase('foo');
[11:30:49] <Rashad> Hello! Should I keep closing the database after each insertOne() [or any operation] like how it is done here: https://docs.mongodb.org/getting-started/node/insert/ ?
[11:31:07] <contracode> Derick: thanks for that! I think you saved a headache later on today
[11:31:14] <Rashad> And in general, when should I close the db?
[11:31:42] <contracode> I'll be moving the PHP/MongoDB code base from an old machine that nobody knows about to a new one-- and the new machine will have a new driver
[11:32:06] <contracode> so, I'm guessing I'll have to swap out the selectDatabase() logic
[11:32:11] <contracode> appreciate it! thank you!
[11:32:42] <Derick> Rashad: don't close the connection
[11:32:49] <Derick> Rashad: leave the drivers to do it
[11:33:01] <Rashad> So no db.close(); ?
[11:33:15] <Derick> contracode: new driver - as in the new "mongodb" driver? or an update "mongo" driver?
[11:33:46] <StephenLynx> Rashad no, you dont close the database after each query.
[11:33:54] <StephenLynx> you should reuse the connection.
[11:35:26] <Rashad> In the tutorial it always db.close[s]() the connection.
[11:35:41] <Rashad> How do I reuse the connection?
[11:36:24] <StephenLynx> just have a common reference to it.
[11:36:26] <Rashad> (right now what I understand from you is that I do db.connect() only once, and then do all my operations elsewhere)
[11:36:37] <Rashad> elsewhere = outside the callback of db.connect()
[11:36:49] <Rashad> Oh I see. It returns an object.
[11:36:52] <StephenLynx> which driver are you using?
[11:36:59] <Rashad> The default one.
[11:37:03] <StephenLynx> terminal?
[11:37:22] <Rashad> No, node.js one.
[11:37:31] <Rashad> "var db = require('mongodb').MongoClient;"
[11:37:42] <contracode> Derick: I'm moving legacy PHP code to a new system, since the current system went unmaintained long enough for it to be unservicable
[11:37:45] <StephenLynx> I can link you my project so you can see how I work with it.
[11:38:02] <Rashad> StephenLynx: Yes please.
[11:38:02] <Derick> contracode: okay
[11:38:12] <Derick> contracode: you said you were updating to a new mongo driver too though
[11:38:13] <contracode> Derick: So, I'm doing a fresh install of applications (Apache, MySQL, MongoDB, etc.) into a VM
[11:38:21] <StephenLynx> https://gitlab.com/mrseth/LynxChan/blob/master/src/be/db.js
[11:38:47] <contracode> I assume that the newest mongo driver will be installed by 'sudo pecl install mongo', yes?
[11:38:56] <Derick> pecl install mongodb is newer
[11:38:58] <Rashad> StephenLynx: Thanks.
[11:39:03] <Derick> mongo is now deprecated
[11:39:15] <Derick> not, not so much tutorials yet!
[11:39:26] <contracode> :)
[11:39:36] <contracode> so, even for legacy code, you'd recommend 'pecl install mongodb is newer'?
[11:39:39] <contracode> whoops
[11:39:46] <contracode> well, the 'mongodb' variant?
[11:39:50] <Derick> contracode: are you redoing your mongodb code in PHP?
[11:40:16] <Derick> contracode: and/or moving to a project with composer managing dependencies?
[11:40:16] <contracode> I'd rather not-- I'm just porting the code from one system to another
[11:40:24] <contracode> the latter
[11:40:35] <contracode> well, not even the latter
[11:40:47] <contracode> I'm reprovisioning an application server that nobody supported
[11:40:51] <Rashad> StephenLynx: Oh so it doesn't return a connection variable...
[11:41:03] <Derick> contracode: ok - I think you should stick with "mongo" then
[11:41:16] <Rashad> The way you do it is not the way I want to do it. Is there another way?
[11:41:38] <StephenLynx> probably, this driver usually gives you options, check the documentation
[11:41:46] <contracode> thanks again, Derick :)
[11:41:55] <StephenLynx> http://mongodb.github.io/node-mongodb-native/2.0/api/
[11:42:18] <Rashad> Thanks for the link.
[11:43:37] <Rashad> In the link it's closing the connection each time, like the tutorial. My background is in SQL databases with php where you have a connection object that you use for operations and then after all the operations you close the db.
[11:44:00] <Rashad> Here I have to do all the operations inside the connection callback instead.
[11:44:20] <StephenLynx> that is an example
[11:44:30] <StephenLynx> if you close it on every query, your performance will go down the drain
[11:44:50] <StephenLynx> and you dont have to perform everything inside the connection callback
[11:44:53] <StephenLynx> refer to my code.
[11:45:13] <StephenLynx> you can set a common reference to what you get from the callback.
[11:45:58] <StephenLynx> you can either have a reference to the connection itself or the collections
[11:46:01] <Rashad> Oh I see! You keep the db.collection('...') variable.
[11:46:26] <StephenLynx> this driver by default uses a connection pool
[11:46:36] <StephenLynx> and will close idle connections on itself.
[11:46:56] <StephenLynx> when you close it, you are shutting down the high-level connection of the driver, not a real connection to the database.
[11:47:22] <StephenLynx> so you only close it when you want your software to end.
[11:47:48] <StephenLynx> otherwise it will keep node from finishing your software.
[11:48:08] <Rashad> OK.
[11:48:45] <StephenLynx> https://gitlab.com/mrseth/LynxChan/blob/master/src/be/boot.js#L396 for example
[11:49:18] <dddh> StephenLynx: is it singleton ?
[11:49:20] <StephenLynx> no-daemon means I don't want to start the server and listen to connections. so in this case, I close my connection when all pre-boot operations are done
[11:49:26] <StephenLynx> dddh no idea.
[11:49:43] <StephenLynx> at least it looks singleton-ish.
[11:50:03] <StephenLynx> but when I think about it, it isn't.
[11:50:14] <StephenLynx> it doesn't force you to get The One instance.
[13:18:15] <steerio> anybody knows anything about this? "mongo: symbol lookup error: mongo: undefined symbol: _ZN5boost15program_options3argB5cxx11E"
[13:25:17] <steerio> ^ was an arch linux problem, solved
[13:42:29] <deathanchor> library?
[14:36:38] <whyhankee> Hi, Mongo's CloudManager is complaining about a backup agent on a machine that does not exists anymore. Anyone know of a way to reset/refresh/fix that?
[14:38:01] <whyhankee> it also appears in the deployment's server-list but the '...' option is locked for some reason
[16:23:34] <nalum> hello, quick question about mongodb. In version 2.* the enterprise version was needed in order to use tls secured connections, is this still the case with version 3.*? The site is confusing me on this point.
[16:24:07] <Derick> I think SSL has been put into the standard build in 3.0... let me see if I can find out
[16:26:14] <StephenLynx> from what I heard, it was mostly an issue with cross compiling
[16:29:53] <Derick> the one I just downloaded has:
[16:29:54] <Derick> derick@gargleblaster:~/install $ mongodb-linux-x86_64-debian71-3.2.0/bin/mongod --version
[16:29:58] <Derick> db version v3.2.0
[16:30:00] <Derick> git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
[16:30:03] <Derick> OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
[16:30:08] <Derick> not present in 2.6 or 3.0, and it's not the enterprise build
[16:32:22] <nalum> Thanks Derick
[20:33:48] <kexmex> Can someone help with perf issues?
[21:36:09] <kexmex> is ObjectId() sortable?
[21:36:14] <kexmex> i.e does it sort by date?
[21:36:22] <cheeser> more or less
[21:39:01] <GothAlice> kexmex: https://docs.mongodb.org/manual/reference/object-id/
[21:39:10] <kexmex> ok thanks
[21:39:17] <kexmex> the other thing is, i got major perf problems
[21:39:31] <kexmex> mongodump is taking forever-- i got a 1mil+ collection
[21:39:53] <kexmex> could it be that SSD is faulty?
[21:40:08] <GothAlice> ObjectIds are compared as if they were just really big numbers. But because of the order of the fields, this means you get "ascending" sort on [unix timestamp, machine, process, counter which wraps]. So within a single second, records may be in a relatively unusual order, but between seconds you do indeed get time order.
[21:41:27] <kexmex> unless some records were created on another machine? or timestamp goes in front?
[21:43:44] <kexmex> i need to diagnose a perf problem really-- even find() commands are slow (more than enough mem to fit the DB)