It has come to my attention that not many people around here know about code profiling. This is a very crucial step to finding key bottlenecks, slowdowns, and so on.
Basically, a profiler is a set of tools that analyzes code and measures the frequency (CPS) that the application preforms a call (function, procedure, method, etc). There are other profilers, such as memory profilers, which gather data of memory hard faults of the process, inclines, declines, etc. This in particular can help you find the right time to garbage collect, see what things keep using up so much memory, measure how much memory a single player takes on the server, etc. Profilers help you figure out what's hogging memory, what's making your CPU spike, and why it's lagging your server by profiling your code whilst the application is running.
For example, say you have just written a new framework, and you're about to get online to test out if login works, but you notice that the CPU spikes when the person tries to submit a login request. Login is a crucial part of your framework, because if you were to be flooded, or attacked by a 'DOS', you could very well lose alot of CPU usage, and so on. So what we have to do is profile the login section of the code, and see where these spikes are. Profilers may vary, but most of them give precise-to-the-line results, so you can find out the bottleneck easily. After you find what the problem is, you try and resolve it. This is very common practice in the enterprise community, and should be brought to a local hobby development aswell, because everyone likes a smooth ongoing server.
There are many profilers, that expand between different languages such as Java, C/C++, .NET, and even web profiling (eg. Pyhon, PHP, Perl).