Mailinglist Archive: opensuse (1239 mails)

< Previous Next >
Re: [opensuse] Re: XFS and openSUSE 12.1
  • From: Roger Oberholtzer <roger@xxxxxx>
  • Date: Wed, 12 Jun 2013 17:07:19 +0200
  • Message-id: <1371049639.16366.102.camel@acme.pacific>
On Wed, 2013-06-12 at 14:06 +0200, Per Jessen wrote:
Roger Oberholtzer wrote:

If you let your test app run, and the file it creates grow and grow,
how does the cache usage progress?

It stayed at about 1G.

Here is my test app, which tyies to capture the spirit of what the real
app is doing. It demonstrates the cache growing issue on both 12.1 and
12.3.

cc diskio.c -o diskio

It makes big files in the directory from which it is run. It runs until
you kill it. The trace statements are periodic listings of the data
rate, max and most recent write times. aka, what was interesting to me.

I used xosview to monitor the memory cache. Deleting the files it makes
frees the cache. Of course, in my real world use, deleting them is not
an option...

In the real app, the write calls are whatever the compression library
does. We used more than one and each does this differently: one does
lots of little fwrites, and one does bit chunks at a time. As they are
opened as FILE and thus buffered, I do not think the specific fwrites
makes a difference. It is the data rate,


Yours sincerely,

Roger Oberholtzer

Ramböll RST / Systems

Office: Int +46 10-615 60 20
Mobile: Int +46 70-815 1696
roger.oberholtzer@xxxxxxxxxx
________________________________________

Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden
www.rambollrst.se


#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

static unsigned long CurrentMilliseconds(void) {

struct timeval timevals;

gettimeofday(&timevals, NULL);

return((timevals.tv_sec * 1000) + timevals.tv_usec / 1000);
}

// Note that this program runs until interrupted. It does not call fclose.
// Calling fclose does not change the behavior. If in doubt, have the for() loop
// end and see that there is no difference...

int main() {

int n, fnum = 0;
unsigned long int t0, maxt;
double total;

while (1) {

FILE *fp;
char fname[32];
int l;
char *data = calloc(100000, 1);

sprintf(fname, "tfileZYZABC%d", ++fnum);

fp = fopen(fname, "w");

t0 = CurrentMilliseconds();

for (l = maxt = 0, total = 0.0, n = 0; l < 4200; ++l) {

unsigned long int elapsed, t2, t1 =
CurrentMilliseconds();
fwrite(data, 100000, 1, fp); // Do a bunch of writes.
fwrite(data, 100000, 1, fp); // One big or many
small do
fwrite(data, 100000, 1, fp); // not seem to make a
difference
fwrite(data, 100000, 1, fp); // for the issue at
hand.
fwrite(data, 100000, 1, fp);
t2 = CurrentMilliseconds();

++n;
total += (500000. / 1000000.); // MBs written
elapsed = t2 - t1;

if (elapsed > maxt) { // Keep track of the longest
write delay

maxt = elapsed;

fprintf(stderr, "%d: %lu msecs\n", n, maxt);
}

if (!(n % 100)) {

double rate = total / ((double)(t2 - t0) /
1000.0);
fprintf(stderr, "%d: %lu msecs max %lu last %f
MB/Sec\n", n, maxt, elapsed, rate);
}

// If you uncomment this, the loop will happen 50 times
per second instead
// of being free running.

// usleep(20000 - (elapsed * 1000)); // Loop 50 per
second...
// usleep(20000); // Loop 50 per second...
}

fclose(fp);
}

return 0;
}
< Previous Next >
This Thread
Follow Ups