A cron job increases RAM usage at midnight

Discussion in 'ISPConfig 3 Priority Support' started by Noethys, Mar 24, 2024.

  1. Noethys

    Noethys New Member HowtoForge Supporter

    Hello everyone,

    (Sorry for my English, I'm French.)

    Every night, at midnight, the RAM usage suddenly increases a lot and crashes my server. How can I identify the cron task that is using so much RAM?

    Thanks for your help
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Various jobs run at midnight, e.g., backups and statistics. How much RAM does your server has, and have you added a swap partition or table?
     
  3. Noethys

    Noethys New Member HowtoForge Supporter

    RAM = 32 Go. No swap.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, 32GB is quite a lot already. Nontheless, you should consider adding a swap file of the same size and see if this fixes the issue.
     
  5. Noethys

    Noethys New Member HowtoForge Supporter

    Thx. I had "fallocate failed" with a swap size of 32GB, so I was only able to create a 4GB swap. I don't know if that will be enough, I'll see next night...

    I wonder if it's the backup that's using all that RAM. Can I temporarily disable backup of all sites?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no config option to disable it for all sites at once.
     
  7. Noethys

    Noethys New Member HowtoForge Supporter

    If I delete this file, it doesn't disable backup ?
    /usr/local/ispconfig/server/lib/classes/cron.d/500-backup.inc.php
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    This will disable the backup as you remove the code that does the backup.
     
  9. Noethys

    Noethys New Member HowtoForge Supporter

    Ok thx. I'm already going to try with swap file. Lets' wait midnight :)

    Have a good day
     
  10. pyte

    pyte Well-Known Member HowtoForge Supporter

    Check the syslog of the system. If the RAM usage is causing trouble to the system the init system will start oom killing processes to keep operating, you should see oom-killer messages if thats the case.
     
    till likes this.
  11. Noethys

    Noethys New Member HowtoForge Supporter

    Hello,

    Thanks for the suggestion. This is what I looked for in the logs, but without success. Strange... I am nevertheless convinced that it is indeed the RAM which is to blame.

    But yesterday I think I finally solved the problem.

    It was obviously the nightly backups of ISPCONFIG that were consuming too much RAM. This is what I did:

    I identified backups that were too large and reduced the data to be backed up. Then I added cron jobs like this:

    crontab -e
    55 23 * * * sudo sync; echo 1 > /proc/sys/vm/drop_caches
    00 2 * * * sudo sync; echo 1 > /proc/sys/vm/drop_caches


    This has the effect of cleaning the RAM before and after backups.

    And it works now: the server no longer freezes.

    Thanks for your help.
     

Share This Page