For Programmers: Free Programming Magazines  


Home > Archive > Compression > September 2004 > ZLIB 1.2.1 - excessive page faults? Bug? Strange...!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ZLIB 1.2.1 - excessive page faults? Bug? Strange...!
PokerAddict

2004-09-15, 8:55 am

Hi there

See the following small test program:

-------------------
unsigned char src[10000];
unsigned char dst[10500];
unsigned long dstlen = 10500;
while (1)
{
long r = compress2( (unsigned char*)dst, // dst
&dstlen, // compressed len
src, // memory to compress
8192, // src len
9); // compression level
Sleep(2);
}
------------------

I use WindowsXP. The compiler is MetroWerks CodeWarrior 9.2

I get a large number of page faults in my program.
TaskManager says 20.000/s. This is a problem, since
we are creating a large application with 10.000 connections
at the same time, and use the zlib to compress the traffic.
But with so many page faults the program runs slow.

I have no idea whats going on, even trying to looks around
alot in your code.

Why would the compressor generate page faults...???

sincerely
Søren


Mark Adler

2004-09-16, 3:55 am

"PokerAddict" <sodan@NOSPAMsodan.dk> wrote in message news:
> Why would the compressor generate page faults...???


There is apparently very little real memory available to that task.
zlib uses on the order of 256K bytes as a hash table, with essentially
shotgun reads and writes. So somehow your task is getting less than
256K of real memory (on a modern machine with a few orders of
magnitude more memory?).

mark
Dr Chaos

2004-09-16, 9:02 pm

PokerAddict wrote:
> Hi there
>
> See the following small test program:
>
> -------------------
> unsigned char src[10000];
> unsigned char dst[10500];
> unsigned long dstlen = 10500;
> while (1)
> {
> long r = compress2( (unsigned char*)dst, // dst
> &dstlen, // compressed len
> src, // memory to compress
> 8192, // src len
> 9); // compression level
> Sleep(2);
> }
> ------------------
>
> I use WindowsXP. The compiler is MetroWerks CodeWarrior 9.2
>
> I get a large number of page faults in my program.
> TaskManager says 20.000/s. This is a problem, since
> we are creating a large application with 10.000 connections
> at the same time, and use the zlib to compress the traffic.
> But with so many page faults the program runs slow.
>
> I have no idea whats going on, even trying to looks around
> alot in your code.
>
> Why would the compressor generate page faults...???


it may have nothing to do with this. Might it be
a dynamic linking problem? Can you link in the compressor
library statically?

>
> sincerely
> Søren
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com