Ask HN: What are must-know concepts for back end development?
491 pointsI’d like to learn more about backend development but most of what I find while searching are results like “Build a nodejs backend in 20 minutes” or “learn backend development in an hour.” I think part of the problem is I don’t know enough to ask the right questions.
Comments (130) 48 threads
Show all comments
Showing thread 10 of 48
So:
- Set up some kind of logging, by default use rsyslog and set it up so your logs are available somewhere other than the machine where something is running. You will be surprised how often something breaks and takes the server down with it so you can't log in.
- Later on, when you have to debug stuff, READ THE LOGS. I can't explain it, but after years of working on production systems I have noticed that almost nobody actually goes back and just reads the logs when things go wrong. You will find the problem spelled out in the logs 99% of the time. YOU CAN'T JUST GUESS WHAT WENT WRONG.
- Use transactions properly.
- If you use an ORM, do whatever you need to do to keep track of how many actual queries are done. You are going to find that you do some order of magnitude more queries than you thought. Learn how to give the ORM hints to avoid this.
And work on your logs. Tweak the info/error/debug levels so that the log files read nice. Too often we find that a common error/exception will spew hundreds of lines of shite into the log files over and over again, obfuscating the real information. Take pride in having meaningful, concise but informative log files.
YES! At one company I was at their web service framework would log thousands of lines of nonsense for every request, most of it errors about not being able to connect to services that no longer existed or thousands of lines of debugging that were never relevant to anything. Make sure you are only logging sensible things (usually this means when you see something being logged for no reason or which is no longer relevant, fix things), and if you want to log a ton of garbage, set things up so you can tell the difference and throw out the junk.