title: In Linux, how do I determine optimal value of optmem_max?
body: <p>We have a Linux project where we are pushing struct information over buffers. Recently, we found that the kernel parameter optmem_max was too small. I was asked to increase this by a supervisor. While I understand how to do this, I don't really understand how I know how big to make this.</p>
  
  <p>Further, I don't really get <em>what</em> optmem_max is.</p>
  
  <p>Here's what the kernel documentation says:</p>
  
  <p>"Maximum ancillary buffer size allowed per socket. Ancillary data is a sequence of struct cmsghdr structures with appended data."</p>
  
  <p>(I don't really understand what this means in English).</p>
  
  <p>I see many examples on the Internet suggesting that this should be increased for better performance.</p>
  
  
  
  <p>In:</p>
  
  <blockquote>
    <p>/etc/sysctl.conf</p>
  </blockquote>
  
  <p>I added this line to fix the problem:</p>
  
  <blockquote>
    <p>net.core.optmem_max=1020000 </p>
  </blockquote>
  
  
  
  <p>Once this is done, we got better performance.</p>
  
  
  
  <p>So to summarize my question: </p>
  
  <ol>
  <li><p>In English, what is optmem_max?</p></li>
  <li><p>Why is it so low by default in most Linux distros if making it bigger improves performance?</p></li>
  <li><p>How does one measure what a good size for this number to be?</p></li>
  <li><p>What are the ramifications of making this really large?</p></li>
  <li><p>Aside from /etc/sysctl.conf, where is this set in the kernel by default? I grepped the kernel, but I could find no trace of the default value of optmem_max being set to 20480 which is the default on our system.</p></li>
  </ol>