[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
overly aggressive memory usage by sort.c
From: |
Jeff Janes |
Subject: |
overly aggressive memory usage by sort.c |
Date: |
Thu, 7 Jun 2012 13:12:22 -0700 |
In commit a507ed6ede5064b8f15c979e54e6de3bb478d73e, first appearing in
v8.16, the default memory usage was changed to take all of available
memory, rather than half of it. I think this is too aggressive.
If I start a very large file sort on a previously idle server, it will
report almost all physical memory as being available, and so sort will
take all of it. But as soon as the heavy IO (reading the data to be
sorted, writing temp files) starts up, the kernel needs more memory
for buffering in order to make the IO efficient. The kernel and the
sort start competing for memory, a little bit of paging/swapping
starts, time in iowait increases, and the overall sort performance
drops by roughly a factor of 2.
I don't know what the correct proportion of available memory to take
would be, but I think it is >0.5 and <1.0. Maybe 0.75. But I think
that just going back to 0.5 would be better than the status quo. Or
perhaps the upper limit clamp could be based on physical memory
instead of available, so rather than:
mem = MAX (avail, total / 8);
maybe:
mem = MIN(total/4*3, MAX (avail, total / 8));
Cheers,
Jeff
- overly aggressive memory usage by sort.c,
Jeff Janes <=
- Re: overly aggressive memory usage by sort.c, Pádraig Brady, 2012/06/07
- Re: overly aggressive memory usage by sort.c, Jim Meyering, 2012/06/11
- Re: overly aggressive memory usage by sort.c, Paul Eggert, 2012/06/11
- Re: overly aggressive memory usage by sort.c, Paul Eggert, 2012/06/11
- RE: overly aggressive memory usage by sort.c, Voelker, Bernhard, 2012/06/11
- Re: overly aggressive memory usage by sort.c, Paul Eggert, 2012/06/11
- [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Bernhard Voelker, 2012/06/14
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jim Meyering, 2012/06/20
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jeff Janes, 2012/06/20
- Re: [PATCH] maint: cleanup size determination in sort [was: overly aggressive memory usage by sort.c], Jim Meyering, 2012/06/20