However, name-server lookups are a quite a bit slower than usual.
With 2.2.1, I can do nearly 1,000 lookups per second.
This is tested by reading a local hosts file into memory, then using
those names to query the local-domain name-server over and over again.
The difference is too remarkable to be a testing problem. It's down
to 100 per second. It seems as though the kernel will now only
allow one per HZ, artifically attenuated. Just a feeling.
#include <stdio.h>
#include <netdb.h>
#include <signal.h>
#include <malloc.h>
#include <time.h>
#define BUF_LEN 0x100
int num=0;
void quit(int unused)
{
int tens;
tens = num/10;
num -= (tens * 10);
printf("Lookups = %d.%d\n", tens, num );
fflush(stdout);
exit(0);
}
typedef struct lnk {
char buf[0x100];
struct lnk *next;
} LNK;
main(int a, char *b[])
{
char buffer[BUF_LEN];
char name[BUF_LEN];
FILE *file;
LNK *link;
LNK *start;
link = (LNK *) malloc(sizeof(LNK));
link->next = NULL;
start = link;
file = fopen ("/etc/hosts", "r");
if(file == NULL) exit(1);
(void)signal(SIGALRM, quit);
while((fgets(buffer, BUF_LEN, file)) != NULL)
{
if((sscanf(buffer, "%*d.%*d.%*d.%*d %s", link->buf)) == 1)
{
link->next = (LNK *) malloc(sizeof(LNK));
link = link->next;
link->next = NULL;
}
}
fclose(file);
alarm(10);
for(;;)
{
link = start;
do {
num++;
if(a > 1)
printf(link->buf);
if(gethostbyname(link->buf) != NULL)
if(a > 1)
puts(" Okay");
else
if (a > 1)
puts(" Failed");
link = link->next;
} while(link != NULL);
}
return 0;
}
Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.2.2 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/