tl;dr: programmer makes game server for webgame, experiences massive CPU spikes, instead of profiling he randomly changes stuff until he finds the actual problem (not deleting past events).
It looks like he's still a student, so this is just the type of learning experience that breaks those bad habits. Hopefully his methodology will be a bit more refined after all this.