Author Topic: How to slow down Spotlight indexer to reduce for Mac's CPU load.  (Read 6151 times)

elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
How to slow down Spotlight indexer to reduce for Mac's CPU load.
« on: February 02, 2014, 10:11:09 PM »
Dear WeatherCat Mac system tinkerers,

Here is another result of my struggles to keep my new MacBook Pro more quiet.  It turns out that this wasn't the worst offender, but Spotlight has a little system program running in the background to index all those files so you can find something based on what's inside those files.  That indexing program is called mds.  I found on the web instructions on how to change how mds runs so that it uses less CPU.  The instructions are quite involved, so I put it up on the Wiki:

http://wiki.trixology.com/index.php/How_do_Run_the_Spotlight_indexer_at_a_lower_priority_to_reduce_CPU_load_on_your_Mac

Now be aware!!  This is by most standards hacking and things can go wrong.  Do not attempt to do this without all due caution!  In particular, DO NOT attempt this on OS 10.9 (Mavericks) !!  "We" found out this doesn't work - da' hard way!!  [banghead]

It should work fine and has been tested on OS 10.8 (Mountain Lion), OS 10.7 (Lion) and OS 10.6 (Snow Leopard).

So if you are bold and adventurous - give it a try!

Cheers, Edouard  [cheers1]

P.S. Thanks to Stu for reviewing the instructions, and thanks to Blick for testing the procedure on OS 10.7 and providing some helpful editing suggestions.

P.P.S. Special thanks to Steve for being da' victim who found out da' hard way this procedure doesn't work on OS 10.9 (Mavericks!!)  :o

Steve

  • Global Moderator
  • Storm
  • *****
  • Posts: 1558
    • DW8454
    • KOHAVON11
    • Avon Weather
  • Station Details: Davis Wireless VP2 Plus w/24 hr FARS, Leaf & Soil Station, 2023 Mac mini M2 Pro, 32GB RAM, Mac OS 14, WeatherCat 3.2
Re: How do Run slow down Spotlight indexer to reduce for Mac's CPU load.
« Reply #1 on: February 03, 2014, 04:02:55 AM »
I found that the best way to keep Spotlight in check is to not use it. ;) I only have it searching for Applications, as that is needed for Launchpad and my MacUpdate app. the mds processes use much less CPU and RAM when they don't have to constantly look through every file. I never got used to using Spotlight, so I don;t miss it.

Also, under Mavericks, there's a constantly growing process called mdflagwriter that is associated with Spotlight. I use Activity monitor to kill it every few days. Only using Spotlight to search Applications it takes about a couple of days to consume 1 GB of RAM, but with the default Spotlight settings it was eating 3+ GB in a bit over a day! Force quitting mdflagwriter doesn't seem to have any deleterious effect on the System.
Steve - Avon, Ohio, USA


CWOP: DW8454 - WU: KOHAVON11 - AWEKAS - CoCoRaHS
PWSweather - WeatherCloud - Twitter - Facebook

Blicj11

  • Storm
  • *****
  • Posts: 3945
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Ventura 13.6 | Sharx SCNC2900 Webcam | WeatherCat 3.3 | Supportive Wife
Re: How do Run slow down Spotlight indexer to reduce for Mac's CPU load.
« Reply #2 on: February 03, 2014, 06:01:14 AM »
Quote
I found that the best way to keep Spotlight in check is to not use it. ;)

Ha ha! Thanks for the tip and even more thanks for the good laugh, Steve.

Nice work Edouard.
Blick


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Typo and buggy Mavericks (Re: Slow down Spotlight indexer)
« Reply #3 on: February 03, 2014, 05:12:41 PM »
Dear Blick, Steve, and WeatherCat system tinkerers,

Oops!  :-[  Blick spotted a particularly embarrassing typo in the title of the article.  I just corrected it and updated the link in my initial post.  For completeness the correct link is:

http://wiki.trixology.com/index.php/How_to_Run_the_Spotlight_indexer_at_a_lower_priority_to_reduce_CPU_load_on_your_Mac

I found that the best way to keep Spotlight in check is to not use it. ;) I only have it searching for Applications, as that is needed for Launchpad and my MacUpdate app. the mds processes use much less CPU and RAM when they don't have to constantly look through every file. I never got used to using Spotlight, so I don;t miss it.

I've been trying to avoid that extreme, but I might be forced into it.  So far getting the mds daemon to run more slowly has made my MacBook Pro behave much better.  However, when I'm forced to upgrade to Mavericks, perhaps there will be no alternative.

Also, under Mavericks, there's a constantly growing process called mdflagwriter that is associated with Spotlight.

That's a bug - can't be anything else.  No system software should have a memory leak like that.  Apple sure has been sloppy in this latest OS release.  >:(

I use Activity monitor to kill it every few days. Only using Spotlight to search Applications it takes about a couple of days to consume 1 GB of RAM, but with the default Spotlight settings it was eating 3+ GB in a bit over a day! Force quitting mdflagwriter doesn't seem to have any deleterious effect on the System.

I assume this mdflagwriter process has some sort of "keep alive" controller like the one that is build into the launchd system that Apple created to replace the clumsy UNIX apparatus to get background system utilities started.  So when you kill it, you are doing something "wrong," but the system compensates for it.  Hopefully Apple will get around to fixing this bug so you don't have to kill that process anymore.

It is a bit disturbing to me that Apple felt the need to monitor these background processes to restart them.  If the code was written correctly, they should crash very rarely indeed.  That is how UNIX systems had worked for decades.  It is a clear indication of what Stu has been telling us for a while: plenty of bugs in these "modern" UNIX systems.

Oh well!!

Cheers, Edouard  [cheers1]