<?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: increasing buf size increases execution time in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182730#M718211</link>
    <description>&lt;BR /&gt;As replied just now, buffers larger then 1MB or so rarely help. Going from 1KB to 8KB to 128KB one would expect nice rapid increase in speed/bandwitdh and reduction in IO /sec needed (glance at it!). Beyond that, towards 1MB one would expect a modest further speedup. You mileage _will_ vary based on IO infrastructure and LVM settings (notably striping/chunks).&lt;BR /&gt;&lt;BR /&gt;As also hinted to before... you are sure that on the sun box you did not accidently end up going to the filesystem file huh?&lt;BR /&gt;&lt;BR /&gt;The program is writing from 'buff' but as coded that starts at a random/uncontrolled address. The actuall IO will need to come from a page alligned intermediate buffer (best I know, correct me if I'm wrong). Check: man setbuf. It is that intermediate buffer that you really want to grow as your a large private buffer might just make more work for the write function to de-block into the io buffer.&lt;BR /&gt;Perhaps Sun does a magic re-allocate based on IO size?&lt;BR /&gt;&lt;BR /&gt;Finally.. we all assume that as you increased the buffer size, you decreased the loop count. I woudl recomamdn hardcoding this in the program statically with defines, or dynamcially with arguments and variables.&lt;BR /&gt;Something like:&lt;BR /&gt;#define TOTAL_IO  100*1024*1024&lt;BR /&gt;#define BUFFER_SIZE 64*1024&lt;BR /&gt;#define LOOPCOUNT TOTAL_IO/BUFFER_SIZE&lt;BR /&gt;char buff[BUFFER_SIZE]&lt;BR /&gt;:&lt;BR /&gt;for (i=0,i&lt;LOOPCOUNT...&gt;&lt;/LOOPCOUNT...&gt;&lt;BR /&gt;Yes, also for 'just a test' program...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Wed, 04 Feb 2004 10:46:15 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-02-04T10:46:15Z</dc:date>
    <item>
      <title>increasing buf size increases execution time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182727#M718208</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Here is my C program&lt;BR /&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;#include &lt;FCNTL.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;  {&lt;BR /&gt;&lt;BR /&gt;  char buff[2621440];&lt;BR /&gt;&lt;BR /&gt;  int fd;&lt;BR /&gt;int i;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  fd=open("/dev/vg00/pacs4", O_CREAT|O_RDWR);&lt;BR /&gt;&lt;BR /&gt;  for (i=0; i&amp;lt;200; i++)&lt;BR /&gt;     {&lt;BR /&gt;      write(fd,buff,2621440);&lt;BR /&gt;      }&lt;BR /&gt;   close(fd);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/dev/vg00/pacs4 is a raw device, when the size of pacs4 is less (within 100MB) execution takes very less time(2 to 3 Minutes). when the size increased (say 500MB or 1000MB) execution time takes around 15Min.&lt;BR /&gt;&lt;BR /&gt;whereas the same program on AIX/Solaris takes just a minute irrespective of pacs4 size.&lt;BR /&gt;&lt;BR /&gt;why is so? is there any kernel parameters to be changed to keep execution time less irrespetive of pacs4 size?&lt;BR /&gt;&lt;BR /&gt;thanx in advance&lt;BR /&gt;Ravi&lt;/FCNTL.H&gt;&lt;/UNISTD.H&gt;</description>
      <pubDate>Wed, 04 Feb 2004 09:47:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182727#M718208</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2004-02-04T09:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: increasing buf size increases execution time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182728#M718209</link>
      <description>When dealing with large i/o like this, the system silently breaks the i/o into smaller chunks (256KB-1MB or so depending depending upon OS version). The speed also depends upon the underlying hardware.&lt;BR /&gt;&lt;BR /&gt;I must say that it is prrobably not wise to open a file descriptor for a raw device with the O_CREAT flag. If the file exists, no harm, but otherwise you are going to open a regular file in the /dev directory and possibly fill up the / filesystem. It is also possible that you are not, in facxt, writing to a raw device as intended if you mispelled slightly or never created the node/LVOL.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Feb 2004 09:56:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182728#M718209</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-02-04T09:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: increasing buf size increases execution time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182729#M718210</link>
      <description>Ravi, &lt;BR /&gt;&lt;BR /&gt;you're are talking about raw devices, but the file name "/dev/vg00/pacs4" looks more like a block special (buffered) device. In this case the buffercache could be responsible for the effect you're observing. Then you could perform the test again with "/dev/vg00/rpacs4".&lt;BR /&gt; &lt;BR /&gt;Best regards...&lt;BR /&gt;Dietmar.</description>
      <pubDate>Wed, 04 Feb 2004 10:39:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182729#M718210</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2004-02-04T10:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: increasing buf size increases execution time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182730#M718211</link>
      <description>&lt;BR /&gt;As replied just now, buffers larger then 1MB or so rarely help. Going from 1KB to 8KB to 128KB one would expect nice rapid increase in speed/bandwitdh and reduction in IO /sec needed (glance at it!). Beyond that, towards 1MB one would expect a modest further speedup. You mileage _will_ vary based on IO infrastructure and LVM settings (notably striping/chunks).&lt;BR /&gt;&lt;BR /&gt;As also hinted to before... you are sure that on the sun box you did not accidently end up going to the filesystem file huh?&lt;BR /&gt;&lt;BR /&gt;The program is writing from 'buff' but as coded that starts at a random/uncontrolled address. The actuall IO will need to come from a page alligned intermediate buffer (best I know, correct me if I'm wrong). Check: man setbuf. It is that intermediate buffer that you really want to grow as your a large private buffer might just make more work for the write function to de-block into the io buffer.&lt;BR /&gt;Perhaps Sun does a magic re-allocate based on IO size?&lt;BR /&gt;&lt;BR /&gt;Finally.. we all assume that as you increased the buffer size, you decreased the loop count. I woudl recomamdn hardcoding this in the program statically with defines, or dynamcially with arguments and variables.&lt;BR /&gt;Something like:&lt;BR /&gt;#define TOTAL_IO  100*1024*1024&lt;BR /&gt;#define BUFFER_SIZE 64*1024&lt;BR /&gt;#define LOOPCOUNT TOTAL_IO/BUFFER_SIZE&lt;BR /&gt;char buff[BUFFER_SIZE]&lt;BR /&gt;:&lt;BR /&gt;for (i=0,i&lt;LOOPCOUNT...&gt;&lt;/LOOPCOUNT...&gt;&lt;BR /&gt;Yes, also for 'just a test' program...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Feb 2004 10:46:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182730#M718211</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-02-04T10:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: increasing buf size increases execution time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182731#M718212</link>
      <description>Thanx Dietmar&lt;BR /&gt;&lt;BR /&gt;Your solution writing to raw device /dev/vg00/rpacs4 worked, irrespective of rpacs4 size.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Feb 2004 10:55:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/increasing-buf-size-increases-execution-time/m-p/3182731#M718212</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2004-02-04T10:55:02Z</dc:date>
    </item>
  </channel>
</rss>

