Skip to content

Instantly share code, notes, and snippets.

@hperantunes
Created August 23, 2015 21:03
Show Gist options
  • Save hperantunes/9da5aa3e857815d12723 to your computer and use it in GitHub Desktop.
Save hperantunes/9da5aa3e857815d12723 to your computer and use it in GitHub Desktop.

HOMEWORK: HOMEWORK 3.2

In a mongo shell run homework.b(). This will run in an infinite loop printing some output as it runs various statements against the server.

We'll now imagine that on this system a user has complained of slowness and we suspect there is a slow operation running. Find the slow operation and terminate it.

In order to do this, you'll want to open a second window (or tab) and there, run a second instance of the mongo shell, with something like:

$ mongo --shell localhost/performance performance.js

Keep the other shell with homework.b() going while this is happening. Once you have eliminated the slow operation, run (on your second tab):

homework.c()

and enter the output below. Once you have it right and are ready to move on, ctrl-c (terminate) the shell that is still running the homework.b() function.

db.currentOp()
db.killOp(35)
homework.c()
12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment