PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 12th of September, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[08:26:02] <Dearvolt> Hello everyone :) I'm having trouble getting an update to work on an array nested within some objects and arrays. I am using the Node MongoClient driver. Some code snippets and further explanation are here: http://pastebin.com/bH1hXYi7
[08:26:36] <Dearvolt> I would really appreciate any help :) Not too familiar with Mongo yet and things have been going slowly.
[08:29:31] <Dearvolt> I think I might need to use the positional $ operator?
[08:30:39] <Derick> Dearvolt: looks like a typical relational approach to something...
[08:31:03] <Derick> Dearvolt: instead of storing the fileid in the files[] arrays, store the *section* ID (which you need to add) with file itself.
[08:33:24] <Dearvolt> @Derick: Hahaha, sorry. It has been tricky getting used to the NoSQL approach; It's a completely different mindset. Would I need to assign a unique ID to each section? Or would I just need to store module and section name then search the files collection for anything that matches later on?
[08:33:49] <Derick> yes
[08:33:53] <Derick> the latter is probably even better
[08:35:14] <Dearvolt> Ah, okay, makes sense. Then I could actually eliminate the files array from the section objects.
[08:36:42] <Derick> yes
[08:36:48] <Derick> cause updating nested arrays is tricky
[08:38:08] <Dearvolt> Thanks so much for your help! I'm going to work on that now and I might pop in later again, but I should be good for now. Was just struggling with updating that nested array.
[08:38:34] <Dearvolt> I found code explaining how to update something that's one level in to an object, but my arrays are nested quite deeply.
[08:38:54] <Derick> and that's usually a sign of doing a wrong schema
[08:39:43] <Dearvolt> One of my lecturers told me we need to denormalize as much as possible, so I figured I would need to store as much as possible in a single object?
[08:40:18] <Dearvolt> But it makes sense to remove the files array. Do you think it would be worthwhile separating pages as well? Or sections?
[08:48:29] <Derick> pages, probably, sections, probably not.
[08:49:57] <Dearvolt> Thanks for your help! I really appreciate it, @Derick :)
[16:43:39] <hans_> Hi. What approximately (or asymtotic estimate) is the cost of adding a compound index (say {app_id: 1, _id: 1}) to a, big, collection?
[16:44:57] <hans_> in storage*
[17:56:37] <mw44118> Hey cool kids, I need help loading a medium-size mongo database into my laptop. I used mongorestore to load it, and all goes well until it rebuilds indexes. Then the OS (linux) kills mongod because of memory usage.
[17:57:13] <mw44118> I have 4gb of memory. I set the config cacheSizeGB to 1GB.
[17:57:22] <mw44118> But rebuilding indexes kills me!
[17:59:29] <mw44118> any thoughts?
[17:59:35] <Derick> "medium-size" means what?
[17:59:54] <Derick> how is your memory manager configured
[17:59:58] <mw44118> Derick: 30 GB or so
[18:00:10] <mw44118> Derick: I don't know how my mem manager is configured. What is that?
[18:00:33] <mw44118> Derick: ulimit -m is set to "unlimited"
[18:00:37] <Derick> http://www.tldp.org/LDP/tlk/mm/memory.html
[18:00:44] <Derick> ulimit is something else
[18:00:57] <Derick> what is in the output of "dmesg" (put it on pastebin please)
[18:02:22] <mw44118> http://pastebin.com/PrjPpQh3
[18:02:34] <mw44118> Derick: http://pastebin.com/PrjPpQh3
[18:03:31] <cheeser> might just need to increase your swap
[18:03:48] <Derick> or buy more memory :)
[18:03:51] <mw44118> My swap is 2GB
[18:04:04] <cheeser> might just need to increase your swap
[18:04:05] <cheeser> :D
[18:04:22] <mw44118> cheeser: thx for tip. what's a good swap size?
[18:04:37] <cheeser> how big is your drive? :D
[18:04:46] <cheeser> i honestly don't know. depends on your load.
[18:05:54] <mw44118> cheeser: OK, I'll set swap to 2x memory, so 8gb
[18:40:26] <gvandyk> Hi all, I have a question regarding text indexes on mongo collections... is it possible to create an index on a nested object's values, if the nested object's keys are unknown? So what I'm looking for would be analogous to a wildercard ($**) on a nested array, a la... { "tags": [ "Linux" ], "refs": { "somekey": [ "I would like to be able to search
[18:40:26] <gvandyk> for keywords within this value", "This too", "Well, all values within this array, really..." ] } }
[18:41:14] <gvandyk> "somekey" would be unknown. I'm looking for a performant way to use text indexes here, aside from putting a wildcard index on the entire collection
[19:07:37] <n1colas> Hello
[19:08:08] <gvandyk> Hello
[19:31:46] <MacWinner> is there a simple way to log queries that are not using an index? is it just increasing the profiling level and adding a millisecond query time?
[20:24:03] <herriojr> it's my first time using mongo, and I was given a tar.gz which was produced by the cloud services which is supposed to be a backup, how do I actually restore this tar.gz to a local mongo db? I tried the whole unzip it and point a mongod to that directory, but it doesn't appear to recognize the tables at all
[20:26:38] <AvianFlu> mongorestore, probably
[20:26:50] <AvianFlu> inside the .tar.gz should be folders for each database
[20:26:59] <AvianFlu> you can pass each dir to mongorestore
[20:27:17] <AvianFlu> run mongorestore --help for the specific syntax
[20:40:18] <herriojr> AvianFlu: ty
[20:41:20] <herriojr> AvianFlu: the only issue when I do that is it skips all the files in the db folders saying it doesn't know what to do with it
[20:41:55] <AvianFlu> are you pointing mongorestore at the root folder of the tar.gz?
[20:42:00] <AvianFlu> or at thatfolder/db1/
[20:42:21] <AvianFlu> I had that problem the other day, it was only importing the oplogs because I was pointing it at the root instead of the db folder
[21:07:01] <thebigredgeek> Hey, anyone here have experience writing mongoose middleware?
[21:07:17] <thebigredgeek> I am looking for a way to link a pre and post hook together
[21:07:24] <thebigredgeek> Like an "operation context"
[21:07:32] <thebigredgeek> That could be via an operation UID, or whatever
[21:08:00] <thebigredgeek> I am trying to integrate statsd into mongoose to profile query times, and to do this I need a way to attach a "start time" to an "operation context"
[21:08:09] <thebigredgeek> and then measure the difference in a post hook
[21:11:21] <herriojr> AvianFlu: when importing the db, I tried pointing it to the db folder within the backup and I get that — I also tried pointing it to the root as well
[21:13:15] <herriojr> AvianFlu: http://pastebin.com/JVWB6ku1
[21:16:38] <AvianFlu> herriojr, what are your source and destination mongo versions?
[21:16:43] <AvianFlu> also what produced the backup
[21:16:44] <AvianFlu> ?
[21:18:38] <herriojr> the mongo backup was generated by the mongo cloud service
[21:18:44] <herriojr> in a tar.gz format
[21:18:59] <herriojr> maybe it is a version issue, I'll check that out
[21:20:35] <AvianFlu> does any part of that dump have .json files in it?
[21:20:58] <herriojr> no it doesn't
[21:21:29] <herriojr> there's restoreInfo.txt, seedSecondary.sh, then each of the subfolders such as "admin" with things such as "admin.1" and "admin.ns"
[21:21:30] <AvianFlu> maybe try mongoimport
[21:21:34] <herriojr> kk
[21:21:58] <AvianFlu> that's just a guess, mind you, but reading the --help can't hurt
[21:23:04] <herriojr> kk ty, I'll mess around with it some more
[21:23:12] <herriojr> and i do think it may be a version issue
[21:23:21] <herriojr> apparently they're still running 2.4
[21:23:52] <AvianFlu> ohhh, yeah that could do it
[21:23:56] <AvianFlu> 2.4 is oooooooollllllldddddd
[21:24:46] <herriojr> yeah
[21:53:37] <ashp> Hey guys, I'm hoping for some help.. We're running mongo 2.6 (long story, working on it!) and we're having a lot of problems with really slow queries. Looking in the slow log I see one "remove" op taking 120 seconds. All it does is a remove with a _versionId query
[21:53:45] <ashp> I believe I already have an index for this, but it still seems to take forever
[21:53:57] <ashp> do indexes help with remove stuff? (I'm an ops person, and relatively mongo clueless, trying to get up to speed)
[21:54:17] <cheeser> short answer: probably
[21:54:24] <ashp> "remove db .family_product_available_version query: { _versionId: ObjectId('57d714a8dc88ecdc151f1a41') } ndeleted:0 keyUpdates:0 numYields:33763 locks(micros) w:95844699 169645ms"
[21:54:30] <ashp> feels a little... excessive :)
[21:54:37] <ashp> I assume I've screwed up the index in some way then
[21:54:42] <cheeser> that's a lot of yields
[21:55:06] <ashp> I noticed that, but I don't know anything about what a normal number of yields is (yet)
[21:55:32] <cheeser> it's not entirely my area but i think that's the number of times it's yielded the lock for other operations
[21:55:37] <AvianFlu> yep
[21:55:47] <AvianFlu> that looks like the stats from the 2.6 I upgraded a couple of weeks ago
[21:55:56] <AvianFlu> our biggest problem was lock contention, too many collections in one DB
[21:55:58] <ashp> AvianFlu: So you saw this improve by just upgrading?
[21:55:59] <cheeser> now that might not be *so* bad if there are a lot of documents with that _versionId
[21:56:02] <AvianFlu> everything was fighting over the same set of locks
[21:56:03] <ashp> yeah we have something like 86 collections
[21:56:07] <cheeser> or a lot of documents in general
[21:56:09] <AvianFlu> yeah we had 110 or something
[21:56:18] <ashp> We've tested (thanks to percona) that we can update to 3.0 in the real world
[21:56:19] <AvianFlu> and yeah, immensely better just from upgrading
[21:56:24] <ashp> so if the answer is "upgrade" then that's the answer
[21:56:30] <cheeser> definitely.
[21:56:34] <AvianFlu> we didn't get baseline faster, but load spikes no longer kill us
[21:56:40] <AvianFlu> overall resiliency went way up
[21:56:41] <cheeser> and update to WT if you can. better lock semantics.
[21:56:47] <AvianFlu> now, with 3.0, you only get collection level locks
[21:56:49] <AvianFlu> yeah exactly
[21:56:52] <AvianFlu> 3.2 is doc level locks
[21:57:03] <cheeser> 3.0 had it, too, you just had to opt in to WT
[21:57:04] <AvianFlu> so I've still got a couple of collections that have a mini locking problem
[21:57:10] <AvianFlu> ah, right
[21:57:13] <ashp> Yeah, we didn't get to test 3.2 yet, we took our staging env to 3.0 and it's functioning
[21:57:21] <cheeser> 3.0->3.2 just made WT the default storage engine
[21:57:23] <AvianFlu> I'm approaching all of this from a "huge legacy codebase" perspective
[21:57:24] <ashp> we had to update a bunch of drivers because all our dependencies are super updated
[21:57:27] <ashp> outdated, even
[21:57:27] <AvianFlu> so we did one thing at a time
[21:57:34] <ashp> so we're going to have to do a 3.2 update next and see what breaks all over again
[21:57:47] <AvianFlu> it's not as bad as the auth change, from my experience :)
[21:57:54] <AvianFlu> not running 3.2 in prod yet though
[21:58:37] <ashp> cheeser: yeah, we were able to move to WT in staging, so it's definitely possible
[21:59:00] <ashp> We've been in a situation where someone took a mysql database, slammed it into mongo, then we had zero people with any real mongo knowledge
[21:59:05] <ashp> so it's just kind of decayed since then
[21:59:12] <cheeser> ah. yeah.
[21:59:12] <AvianFlu> yeah, that'll do it
[21:59:19] <ashp> I'm actually just starting the talks with mongo to go full hog on enterprise
[21:59:28] <ashp> because I'm pretty sure what we need is to basically start over with something like ops manager
[21:59:34] <ashp> because it's pretty clear we have no expertise at any of this stuff
[21:59:50] <AvianFlu> that's definitely helpful
[22:00:00] <AvianFlu> they'll be able to teach you about data modelling and stuff too most likely
[22:00:04] <ashp> We're going to have embarrassing conversations like "Can we build a whole new set of servers, with ops manager, and then somehow join our existing cluster and let it all replicate into 3.2 from 2.6.. or something."
[22:00:07] <cheeser> yeah. you'll love it. between the monitoring and the backup, it'll help take some load off.
[22:00:17] <ashp> yeah, our backups are hourly mongodumps off to s3
[22:00:20] <ashp> I'm sure that's hell on performance
[22:00:22] <cheeser> yes, you can.
[22:00:33] <AvianFlu> it sounds like you'll need some in-house data modelling knowledge too
[22:00:43] <AvianFlu> which mongodb can probably provide some consulting on via enterprise stuff
[22:00:43] <cheeser> you can just build a replSet and add the new members and then decommission the old ones as the new ones sync up
[22:00:48] <ashp> AvianFlu: Yeah, it's a mess and I can't imagine it getting better quickly
[22:00:56] <cheeser> you're friendly TSE can walk you through it. :)
[22:01:00] <AvianFlu> shoving an old mysql into a mongo... you're probably doing a few things wrong
[22:01:11] <AvianFlu> and that's likely a piece of the performance fail
[22:01:22] <ashp> I found we have a whole clone of the production cluster for reporting as we didn't know we could just use a replSet with a tag (I think that's the right term)
[22:01:37] <ashp> AvianFlu: Oh it definitely is, we can make all the indexes we like but the fundementals are wrong
[22:01:43] <AvianFlu> yep
[22:01:46] <cheeser> you can use a secondary for reporting if you don't mind some staleness.
[22:01:57] <ashp> The consultant who helped us audit what we've got last week was very polite about telling us "you're doing it all wrong you crazy people"
[22:02:02] <cheeser> 3.4 will make that even nicer with a staleness threshold
[22:02:10] <ashp> cheeser: given that we found in the audit that prod and the reports is already out of sync
[22:02:15] <ashp> we definitely don't mind some staleness
[22:02:33] <ashp> Is there, other than official docs, any book you guys tend to recommend to people trying to come up to speed from scratch
[22:02:35] <cheeser> heh
[22:03:16] <AvianFlu> books about the last 5 years of tech tend to be outdated by the time they're on shelves to be sold :)
[22:03:40] <ashp> yep, even "this guys blogs are great" would be helpful, just some source of relatively up to date info
[22:04:04] <ashp> the docs at mongodb.com are pretty good if you know what you're actually trying to do
[22:04:17] <AvianFlu> I'm not really sure offhand, I'm in the position where I tend to just go google chasing specific problems
[22:04:25] <ashp> my trouble is I don't know what I'm trying to do, so trying to navigate replsets vs shards vs secondaries (which I didn't even know existed) is where it's tough
[22:04:27] <AvianFlu> so I've read some good stuff lately but I didn't really save any of it
[22:04:36] <AvianFlu> yeah, I know the feeling
[22:04:47] <AvianFlu> google "mongodb university" maybe
[22:04:52] <ashp> yeah, I'll probably just keep goggling as issues come up then :)
[22:04:54] <AvianFlu> there's a whole bunch of free webinars
[22:04:58] <ashp> I was going to say, is the university stuff any good?
[22:05:02] <AvianFlu> I signed up for one that starts like next month I think
[22:05:04] <AvianFlu> so, no idea!
[22:05:08] <ashp> I saw some of it ~5 years ago or so when I was at edx
[22:05:12] <ashp> and it seemed like it was ok at the time
[22:05:55] <AvianFlu> can't really say for sure, but there's definitely many levels of info there
[22:06:00] <AvianFlu> and a bunch of beginner-sounding stuff
[22:06:04] <AvianFlu> so it's probably worth a look
[22:06:10] <AvianFlu> and definitely worth the money at free.99?
[22:06:42] <ashp> https://university.mongodb.com/courses/M202/about this looks pretty good
[22:07:07] <AvianFlu> ha yeah that's the one I signed up for