<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ls and high CPU SYS load in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911660#M406261</link>
    <description>You really must change those scripts--they are killing your filesystem performance. I can't imagine any useful purpose in doing an ls on a 10k filesystem. Perhaps the script is looking for a file by using grep (ouch!). hrow out the grep and simply put the string matches in an echo, for example:&lt;BR /&gt; &lt;BR /&gt;Old way: ls /bad_directory | grep *my*file*&lt;BR /&gt; &lt;BR /&gt;Better way: echo /bad_directory/*my*file*&lt;BR /&gt; &lt;BR /&gt;This allows the shell to do the searching. But in all cases, the rapid ls in a way-too-large set of files is crushing your system for no good reason. If you post relevent portions of some of these scripts, we can probably fix them up quite handily.</description>
    <pubDate>Mon, 11 Jul 2005 18:43:20 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2005-07-11T18:43:20Z</dc:date>
    <item>
      <title>ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911656#M406257</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've a server with a CPU bottleneck on SYS CPU, I've been monitoring this and arrive to the conclusion that the cause for the high SYS CPU load is an huge amount of "ls" (more than 1000/min) that some user scripts execute on a filesystem with more than 100.000 files.&lt;BR /&gt;&lt;BR /&gt;Is there a way to tune this from the OS side? How can I improve performance?&lt;BR /&gt;&lt;BR /&gt;Thks&lt;BR /&gt;&lt;BR /&gt;Pedro</description>
      <pubDate>Mon, 11 Jul 2005 07:38:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911656#M406257</guid>
      <dc:creator>Pedro Cirne</dc:creator>
      <dc:date>2005-07-11T07:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911657#M406258</link>
      <description>The way to tune this is to better control what those scripts are doing.  &lt;BR /&gt;&lt;BR /&gt;1000 'ls' command per minute on a filesystem with 100,000+ files is going to hamper performance.&lt;BR /&gt;&lt;BR /&gt;The first step would be to look at what exactly those scripts are doing and see if there is a way to rewrite the scripts to be more efficient and much much much more frugal in the use of the 'ls' command.</description>
      <pubDate>Mon, 11 Jul 2005 07:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911657#M406258</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2005-07-11T07:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911658#M406259</link>
      <description>You might see some small improvements by increasing the buffer cache or by increasing vx_ncsize but bad code is bad code and the real way to fix this is to change the way the scripts work. 1000 ls/min seems a bit excessive -- the overhead of forking that many processes but the other processes that these scripts fork probably accounts for a large portion of your load. &lt;BR /&gt;&lt;BR /&gt;If you are willing to accept a bit of staleness, you might be able to do something like this. Save the results of an ls to a cache file and let the scripts read from this file; a timestamp could be used to determine if the file is too old and if so refresh the cached version.</description>
      <pubDate>Mon, 11 Jul 2005 07:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911658#M406259</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-07-11T07:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911659#M406260</link>
      <description>Pedro,&lt;BR /&gt;&lt;BR /&gt;I believe you are going to have a hard time tuning this out. Might I ask if the files in this file system are created/deleted often? If so you may look at performing regular defragmentation of the file system (I assume vxfs).&lt;BR /&gt;&lt;BR /&gt;fsadm -d -D -e -E /filesystem&lt;BR /&gt;&lt;BR /&gt;Of course you should also look at limiting those 'ls' commands. &lt;BR /&gt;&lt;BR /&gt;David&lt;BR /&gt;&lt;BR /&gt;This could speed up performance in this case</description>
      <pubDate>Mon, 11 Jul 2005 08:11:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911659#M406260</guid>
      <dc:creator>David Child_1</dc:creator>
      <dc:date>2005-07-11T08:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911660#M406261</link>
      <description>You really must change those scripts--they are killing your filesystem performance. I can't imagine any useful purpose in doing an ls on a 10k filesystem. Perhaps the script is looking for a file by using grep (ouch!). hrow out the grep and simply put the string matches in an echo, for example:&lt;BR /&gt; &lt;BR /&gt;Old way: ls /bad_directory | grep *my*file*&lt;BR /&gt; &lt;BR /&gt;Better way: echo /bad_directory/*my*file*&lt;BR /&gt; &lt;BR /&gt;This allows the shell to do the searching. But in all cases, the rapid ls in a way-too-large set of files is crushing your system for no good reason. If you post relevent portions of some of these scripts, we can probably fix them up quite handily.</description>
      <pubDate>Mon, 11 Jul 2005 18:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911660#M406261</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-07-11T18:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: ls and high CPU SYS load</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911661#M406262</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thank you all.&lt;BR /&gt;&lt;BR /&gt;Enjoy :)&lt;BR /&gt;&lt;BR /&gt;Pedro</description>
      <pubDate>Thu, 25 Aug 2005 09:47:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-and-high-cpu-sys-load/m-p/4911661#M406262</guid>
      <dc:creator>Pedro Cirne</dc:creator>
      <dc:date>2005-08-25T09:47:30Z</dc:date>
    </item>
  </channel>
</rss>

