Support » Plugin: Wordfence Security » Wordfence RAM Memory hog?

  • Resolved hartmutnz

    (@hartmutnz)


    Hi, my host company send me a suspension notice due to excessive RAM use. They pinpointed it down to a plugin. I checked the most memory hogging plugins and wordfence was one of them. I disabled the plugin. BUT the scans still run every 24 hours. So I checked and DELETED the plugin and files.. Still no luck, the scan still runs.
    Now I found out I need to edit the Cron Jobs on the server… thanks for nothin.. you promised to fix this issue in “future releases and updates” 2 years ago.. maybe you can address this now? Thanks.

    This is the job ahead: “Note that you need to know the exact time of the next occurrence when scheduled hook was set to run, and the function arguments it was supposed to have, in order to unschedule it. “…

    https://wordpress.org/plugins/wordfence/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Wordfence

    (@mmaunder)

    Please let me know what gives you the impressions it’s Wordfence that is using a large amount of memory – any charts/screenshots/etc that you can post will help us investigate this.

    We already unschedule all cron jobs when you uninstall Wordfence. Please let me know, now that you’ve uninstalled Wordfence from the server and presumably deleted all source code, what is happening that leads you to believe that anything related to Wordfence is executing.

    Thanks.

    Hi there, I understand. I had server CPU loads exceeding 2024 MB RAM use. The P3 profiler tool showed wordfence as the highest RAM user. And SEO Yoast. So I disabled all high use plugins. After that the stats still showed one big spike every 24 hours. So I used your “Wordfence Assistant” plugin (which I found on your website support) to clear the database.. Will update you tomorrow if that still happens now. But I think Wordfence does use a lot of RAM when it runs the Scans. It’s a bit hard to pinpoint though as I don’t have access to the server itself on a shared plan, can’t run tools. I’ll update you tomorrow if I know more, thanks for your help, Groggo

    UPDATE: I now had 2 days of no server issues at all. Practically what I did is remove wordfence. Installed “wordfence assistant” which then removed all database entries that still crawled the site every 24 hours.
    My server cpu had a big 2024 MB spike every 24 hours before. Now it’s fine.
    I must assume here that it was wordfence causing the issue, however there is no prove of course.. just thought this might be worth investigating by you in the future, maybe different servers respond different too.. Thanks, Groggo

    Plugin Author WFSupport

    (@wfsupport)

    If you are using the free version, then likely its the once a day scan we schedule. Its set by cron at the time you install the plugin. However, in the several years I have run the plugin, I have never used near as much ram as you say your server is running. I think I have the ram set to 256mb for Wordfence to use and the most I see reported it used (check the last several lines of the scan report on the scans page) is about 75mb. Below is from one of the sites I manage

    Wordfence used 43.19MB of memory for scan. Server peak memory usage was: 72.87MB

    This is for a well known, high traffic site, with an average number of plugins. It would be interesting to see what options you had checked were.

    Tim

    Hi Tim, thanks for this update. I’ll try to use wordfence on another hosting account soon, maybe it’s to do with that. I do get 2GB Ram there which is good.. but, maybe there is something else going on. All I know at the moment is that after removing wordfence I did not have any more issues there, but this is not to say it is in fact wordfence causing 100% of the issues … thanks for your plugin and great support! Groggo

    I have the same problem too, the mysql server go down every day

    FatMan49

    (@fatman49)

    I am having RAM and memory issues as well. In the settings for WordFence I have set the RAM at 256.

    My last scan used:
    Wordfence used 219.90MB of memory for scan. Server peak memory usage was: 284.03MB

    I have 2 websites on my Media Temple account and we are using 7GB of the 8GB available. MT is pointing a finger at WordFence for the excessive RAM usage.

    Plugin Author WFSupport

    (@wfsupport)

    If you are using 7gb of 89gb for a wordpress site, you must have quite the plugin list. I have a few sites with into the tens of thousands of hits, a decent number of plugins (some ‘home grown’), custom themes, etc and I haven’t ever used more than 80mb.

    @fatman, can you post in your own topic thread so this issues can be tracked? I’ll need a list of plugins and the theme name, plus a screenshot of your options page.

    tim

    FatMan49

    (@fatman49)

    We have 39 plugins running, the biggest is WooCommerce.

    We deleted all the plugins we could, cleaned and optimized the database. We ran P3 Plugin Profiler to see what the plugins were doing. But we still were running 7GB of RAM.

    Finally we deleted WordFence and since then our RAM usage has not been more than 2.5GB.

    I had a similar experience. I have a shared account on GoDaddy. I was using greater than 2GB of RAM. I removed Wordfence and memory usage rarely exceeded 256MB. Since one needs to pay for additional memory I opted to leave Wordfence uninstalled.

    Wordfence is showing excessive memory usage on several of our sites as well.
    On one site in particular (a multisite wp), the amount of memory used is especially high.
    None of the 10 sites on that installation is very large, taken singularly, but as a whole their media files easily total about 4GB.
    The following lines are from the latest scans:

    [Apr 13 15:08:48] Scan Complete. Scanned 66069 files, 47 plugins, 6 themes, 44 pages, 1 comments and 243204 records in 1671 seconds.
    [Apr 13 15:08:48] Wordfence used 414.96MB of memory for scan. Server peak memory usage was: 506.29MB
    [...]
    [Apr 13 15:52:19] Scan Complete. Scanned 66084 files, 47 plugins, 6 themes, 249 pages, 36 comments and 244579 records in 1609 seconds.
    [Apr 13 15:52:19] Wordfence used 427.90MB of memory for scan. Server peak memory usage was: 506.29MB

    It seems there is a lot of database activity related to running scans, and specifically a lot of (costly?) insert queries. Is that normal?
    This is from our mysql log, for every scanned file:

    insert into wp_wfFileMods (filename, filenameMD5, knownFile, oldMD5, newMD5) values ('wp-content/blogs.dir/3/files/ascari/thumbs/thumbs_ascari_3.jpg', unhex(md5('wp-content/blogs.dir/3/files/ascari/thumbs/thumbs_ascari_3.jpg')), 0, '', unhex('3A2BFE49A543D569065099D7553468E0')) ON DUPLICATE KEY UPDATE newMD5=unhex('3A2BFE49A543D569065099D7553468E0'), knownFile=0

    Please note that none of those files indexed is new, and their checksum hasn’t changed. Does every record need to be updated every time?
    We tried adding common image extensions (*.jpg,*.png) to the list of excluded files, but to no avail: the queries are still there.
    MySql on the server peaks at 200 queries/s for the duration of the scan.

    Please address this issue ASAP, since using Wordfence is becoming very taxing on our servers, and even though the plugin on the whole is extremely well done, and we’ve recently purchased several licences, we are considering uninstalling it.
    Thank you,
    Enrico

    Just to clarify my previous post: not every wordfence installation shows the same amount of memory usage.
    The scans seem to average at around 40MB, which is fine for us. Some sites deviate considerably though, all the way up to 200 or even 400MB, and a single one of those is enough to threaten the stability of an entire shared server.
    Here are some logs from other sites that consistently use more RAM than the average – but not as much as the previous example:

    [Apr 14 14:37:44] Scan Complete. Scanned 36317 files, 29 plugins, 7 themes, 2959 pages, 3829 comments and 141732 records in 324 seconds.
    [Apr 14 14:37:44] Wordfence used 186.21MB of memory for scan. Server peak memory usage was: 256.06MB
    [Apr 14 07:39:37] Scan Complete. Scanned 7952 files, 25 plugins, 4 themes, 158 pages, 0 comments and 34391 records in 46 seconds.
    [Apr 14 07:39:37] Wordfence used 152.32MB of memory for scan. Server peak memory usage was: 207.24MB

    WordPress default memory limit is only 40 mb. Wordfence default is 256 mb.

    As we’ve just transferred from shared hosting to Digital Ocean, we can’t afford plugins which use up more memory than WordPress cause it will hit the memory limit and kill mysql.

    I’ve set Wordfence to 50 mb limit for its scans. If it takes more than 50 mb though, I’ll have to find another security plugin.

    Plugin Author WFSupport

    (@wfsupport)

    If you would like an answer to your questions, please post our own topic in the forum. When a post is marked resolved, it generally does not get looked at, especially if the post is over 3 months old.

    @hlango While I don’t like resource hungry plugins either, we have worked to balance the usage of resources with functionality. The more you ask of a plugin,, the more resources it will consume. In sites I have managed that have run multiple plugins, custom themes, and had traffic in the tens of thousands daily, I never used more than 90m. Make sure live traffic is turned off and used only when you want to watch real time analytics. Adjust the update interval to something like 8 and change the maximum execution time to 20. There are lots of things to adjust in WF. If you need further info, I’d recommend looking at http://docs.wordfence.com.

    tim

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Wordfence RAM Memory hog?’ is closed to new replies.