Sometimes Kill -9 Isn't Enough
bravenewgeek.com
bravenewgeek.com
Going back to the topic there are great points there. Remember discovering "tc qdisc" and playing with it. Really nice tool.
But another thing to learn perhaps, is to try to avoid the gray zone by going to either the "black zone" = dead, or "white zone" = working fine. That is, if a node/process/VM/disk start showing signs of failure above a threshold, something else should kill/disable it or restart it.
Think of it as trying to go to stable known states. "Machine is up, running, serving data, etc", "Machine is taken offline". If you can try to avoid in-between "gray states" -- "Some processes are working, some are not", "swap is full and running out of memory, oomkiller is going to town, some some services kinda work" and so on. There are just too many degrees of freedom and it is hard to test against all of them. Obviously somethings like network issues cannot be fixed with a simple restart so those have to be tested.
I've dreamed of patching the kernel and writing two utilities - twim (terminate without mercy) and uwep (unmount with extreme prejudice) that simply remove a process along with all threads, or destroy a mountpoint and drop all associated resources (all filehandles become closed, etc.). Lack of time has mostly stopped me from attempting it, and I'm quite sure it won't be at all trivial.
I was very impressed with its feature-set (for what it is). On our team, we use it to see how our iOS app will react to severe network problems (via testing in the simulator, mostly, though it's also available on iOS devices themselves as explained in the above article).
Even if you introduce these network performance issues, the results are meaningless if you don't have instrumentation ready to capture metrics on the results throughout the network/systems. Everyone wants to write about what happened when they partitioned their network. But you notice how nobody writes about the netflows, the taps, the service monitors, the interface stats, the app performance stats, the query run times, host connection state stats, miscellaneous network error stats, transaction benchmark stats, and hundreds of other data sources that are required to analyze the resulting network congestion.
To me it's much more vital that I can correlate events to track down an issue in real-time. You will never be able to identify all possible failure types by making random things fail, but you can improve the process by which you identify a random problem and fix it quickly.
I once wrote a library for python that injected itself into the main modules (os, sys, etc) and generated random failures all over the place. It worked very well for writing reliable applications, but it only worked for pure python code. I don't own the code, so I can't open source it unfortunately.
http://stackoverflow.com/questions/614795/simulate-delayed-a...
I am still trying to work out how I not knobble my DB connection when trying to simulate client errors on a single dev machine.