How much humour is too much? Is your book too serious for a talking sword? (answer: no. nothing is too serious for a talking sword) Do like having ludicrous things happen to your characters, and your NPCs spout witticisms 24/7? Doing so can bring out a good laugh, but might take away from the drama if done improperly.
I'm not going to tell you how to properly balance humor and drama. The balance is all up to you. What I do want to do is realize how much of each you can and should add in. You can't have a book that's all seriousness and expect to entertain. People are going to be so depressed reading your book that they'll never read it again, even if it is really good. Lighten things up a little bit and your readers will feel refreshed, and you can go darker and deeper.
Have you ever used the pre-programmed routines on a treadmill/ The ones that increase your speed, then decrease it, and go back and forth, following some supposedly beneficial pattern? Well, if it's done right, it is beneficial. And swapping between comedy and seriousness is the same thing. You need to work out the muscles -- limber up your reader's brain so that they can accept the maximum amount of emotional trauma possible. A little sadness, a little humour, a lot of sadness, a terrible ridiculous joke, and even more terrible thing... you get the idea.
There's no reason your Noir can't be jocular, or your medieval characters flippant and even risque. Just read Chaucer's Canterbury Tales and you'll see just how shallow our standard representation of medieval life is.
The same applies in reverse, honestly. If you have a book that is all slapstick comedy and nothing heavier, meatier, you'll find that your book is treated no more seriously than your gags. But add in a little darkness, a little seriousness every so often, and the jokes will be much more meaningful when you make them.
Obviously, I'm not telling you to put crass jokes in every paragraph, and there's no doubt that a misplaced bit can ruin a dramatic scene, but if done properly, and placed tastefully, a good joke can make a dramatic scene all the better. On the other side of the coin, the morbid threat of death can make a good joke great.
So how do you use humour in your book? Do you have a "comic relief?" What kind of tone does your book set? Do you think about placing jokes?