Is it a Best Industry practice to restart web servers periodically? [closed]-Collection of common programming errors
There’s a difference between “Best Practice”, things that many people do for good reasons, and “Common Practice”, things that many people do because they’re lazy and/or ignorant.
Applications and (worse) servers that need to be routinely restarted or rebooted to keep running well are fairly common. But it’s also a clear indication that you have a critical bug.
By making it SOP to restart an application on a regular basis, your company is hiding a serious bug under the carpet. This is inexcusable, the bug needs to be faced down and squashed, or it will come back to bite you later.
Ideally, your company should find a better developer. Unfortunately, this may lead to rather a lot of work to rewrite large tracts of your code. The fact that the developer either thinks that poorly written code is acceptable, or doesn’t know enough to recognize the symptoms of buggy code, suggests the quality of the code is low. A good developer will be constitutionally incapable of leaving it in that state.
Given that you may not be in a position to replace the developer, a few suggestions:
- See if you can have a better developer review the code and report their assessment to someone who can do something about it,
- Have a look into profiling tools. If you’ve got the skills and/or inclination, try profiling the code yourself to find the leak and report it.
Even without getting into developer-oriented profiling tools, there are plenty of sysadmin-oriented tools for profiling and monitoring memory usage on Java applications. You should really set up monitoring of memory (particularly heap) on your production servers in any case. I’d recommend this even if you were running quality code. It may give you advance warning when your buggy apps are about to topple over.
But better yet, these should help you to gather proof that there is a leak, and may even indicate where the issue is in the application. This will give you better ammunition to lobby for it to be fixed.